Skip to content

Instantly share code, notes, and snippets.

@masto
Created June 18, 2013 18:59
Show Gist options
  • Save masto/5808217 to your computer and use it in GitHub Desktop.
Save masto/5808217 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
my $count = shift
or die "Usage: $0 <file count>\n";
my @files = map { open my $file, ">", "part$_.out" or die "open: $!"; $file; } 1..$count;
$files[($. - 1) % @files]->print($_) while <>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment