Well, if it's in a file, I'd do this:
@ARGV = filename.txt;
while(<>)
{
/^(\d)\s+time\s+\d{2}\:\d{2}\:\d{2}\s+(\d+)/;
$hash{$1} = $2;
}
-------------------update--------------
as per merlyn's advice: (godz it's hard not to try to make spaceballs jokes...)
while(<>)
{
if(/^(\d)\s+time\s+\d{2}\:\d{2}\:\d{2}\s+(\d+)/)
{
$hash{$1} = $2;
}
}
or didn't i read something about this possibly being acceptable:
while(<>)
{
{
/^(\d)\s+time\s+\d{2}\:\d{2}\:\d{2}\s+(\d+)/;
$hash{$1} = $2;
}
}
since the enclosing {} puts it in a seperate block? i fully expect to be waaaay off on this.