in reply to Optimizing a script
this is nice and simple (procedural style coding) that you will find easier to understand. run the script "perl script.pl <your_data_file"while($line=<>) { chomp $line; if($line =~ /^\$$/) { #look for start of line, followed by a lite +ral dollar sign, followed by the end of the line (not newline charact +er, but $ has to be at the end of $line) close OUTFILE; undef $data; next; } if(!$data) { open(OUTFILE,">$line") or die; } else { $data = 1; print OUTFILE "$line\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Optimizing a script
by aquarium (Curate) on Apr 19, 2004 at 12:52 UTC | |
by Fletch (Bishop) on Apr 19, 2004 at 13:09 UTC | |
by aquarium (Curate) on Apr 19, 2004 at 13:25 UTC |