in reply to replace with hash value?!

You want something more like:
if (m/(\d+\.\d+\.\d+\.\d+)/) { my $PRTABL=$1; s/\w{3} \w{3} \d+ \d+:\d+:\d+ \d{4}/$clocks{$PRTABL}/; } else { warn "match failed"; }
Otherwise you're not guaranteed to have a sensible value in $1. You might still have the result from a previous match...

Replies are listed 'Best First'.
Re^2: replace with hash value?!
by lcollins (Novice) on Jan 19, 2005 at 13:12 UTC
    interesting, but I don't understand why the print statement that follows gives the correct value from the hash?? It seems as if the hash and variable in the s/// works differently from the print statment?