Help for this page

Select Code to Download


  1. or download this
    my $x = rand(65536);
    foreach (@lines) {
    ...
       print $fh_out $_;
       $x = ($x + 1) % 65536;
    }
    
  2. or download this
    my $x = 0;
    foreach (@lines) {
       open(my $fh_out, '>', sprintf('prefix.%04d.txt', $x++)) or die;
       print $fh_out $_;
    }
    
  3. or download this
    while (<$fh_in>) {
       open(my $fh, '>', sprintf('prefix.%04d.txt', $.)) or die;
       print $fh_out $_;
    }