Greetings,
Trying to be "cool" and apply map to the following lines of code (which work
fine as shown)
@TIMES is an array of lines that look like
Time: Thu Feb 3 15:10:39.290 GMT 2005 End: Default.2.def-edtp0.on
Time: user 0.29 sec Delta: Default.2.def-edtp0.on
Time: Thu Feb 3 15:10:43 GMT 2005 Start: Default.1.def-slpr-2m-t-10m-wind0.on
Time: Thu Feb 3 15:10:43.580 GMT 2005 End: Default.1.def-slpr-2m-t-10m-wind0.on
Time: user 0.58 sec Delta: Default.1.def-slpr-2m-t-10m-wind0.on
use Tie::IxHash;
tie %BY_PROJ_HASH, "Tie::IxHash";
my @DELTAS = grep (/Delta/, @TIMES);
foreach (@DELTAS) {
$_ = /(\d+\.\d+)\s+sec\s+Delta:\s+[Default\.]*\s*(.+)[\.on]*$/;
my $proj = $2;
my $time = $1;
print "<br>$proj => $time\n" if ($DEBUG == 1);
# Push the value into the hash making the value for the hash
# an array (See Perl Cookbook Recipe 5.7)
push( @{$BY_PROJ_HASH{$proj}},$time);
}
So far haven't had any luck using map to create the hash of arrays
%BY_PROJ_HASH.
Any suggestions?
Thank you
John Kent
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>