in reply to Re: Splitting long file
in thread Splitting long file
My take on the whole problem would be slightly more verbose:
Update: $filename should contain the name of the BIG file, of course.open BIGFILE, $filename or die "Could not open $filename:$!\n"; while (<BIGFILE>) { unless (defined($smallfile)) { $smallfile=$_; chomp $smallfile; open(SMALLFILE,">$smallfile") or die "Could not open smallfile $sm +allfile (referenced in $.): $!\n"; } elsif (/^\$$/) { close(SMALLFILE) || die "Could not close $smallfile:$!\n"; $smallfile=undef; } else { print SMALLFILE; } } close BIGFILE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Splitting long file
by TilRMan (Friar) on Apr 08, 2004 at 10:47 UTC | |
|
Re: Re: Re: Splitting long file
by Micz (Beadle) on Apr 08, 2004 at 11:32 UTC |