in reply to Log File Parsing using "split"
You're kind of care free when mixing $thiscust with record fields, hash keys and file handles. Maybe something more like this:open (LOGFILE, "< $logfile") or die ("Could not open $logfile: $!");
$thiscust = (split /\//, $fields[4])[1]; if ( ! $cust{$thiscust} ) { print "customer $thiscust\n"; $cust{$thiscust} = $thiscust; open (my $fh, ">> ${prefix}${thiscust}${suffix}") or die ("Cannot open ${prefix}${thiscust}${suffix}: $!"); $cust{$thiscust} = $fh; } my $fh = $cust{$thiscust}; print $fh $_;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Log File Parsing using "split"
by nobull (Friar) on May 20, 2006 at 11:43 UTC | |
by ruzam (Curate) on May 21, 2006 at 04:05 UTC |