Re: Print to new file for each results



On Wed, 2006-08-30 at 00:16 -0400, Ron McKeever wrote:
I am tring to use part of someones elses code that creates a data file which prints
out like this:

ip|result|deptA|data
ip|result|deptB|data
ip|result|deptC|data

If you can ignore efficiency (not run very often...) then you can simply
reopen the file for each record.

while( <> ) {
my @lines = split(/[|]/);
my $file;

open( $file, '>>', "$lines[1].out" ) or die...
print $file $_;
close( $file ) or die...;

}

--
Ken Foskey
FOSS developer

.