Hi guys. I had pretty big report, which sbd had to view with Excel. But Excel don't support more than 65 000 row. My source is:
It is pretty simple task and the script works perfect. So I just want to ask if there is any way to do it better or simpler, or how the code structure would look better.
Corwin
Code:
#!/usr/bin/perl -w
use strict;
my $input_file = shift;
my $line_counter = 65000;
my $extention = 1;
print "Input file not defined!\n" unless $input_file;
open INPUT, "< $input_file"
or die "Couldn't open input file! $! \n";
&open_new_output_file;
while (<INPUT>) {
unless ($line_counter) {
&open_new_output_file;
}
print OUTPUT $_;
$line_counter--;
}
sub open_new_output_file {
close OUTPUT;
open OUTPUT, "> $input_file.$extention";
$extention++;
$line_counter = 65000;
}
It is pretty simple task and the script works perfect. So I just want to ask if there is any way to do it better or simpler, or how the code structure would look better.
Corwin