Do you know where your variables are? | |
PerlMonks |
Re^3: Need help in extracting timestamp from the line in a fileby Athanasius (Archbishop) |
on Mar 09, 2015 at 17:09 UTC ( [id://1119355]=note: print w/replies, xml ) | Need Help?? |
Hello jayu_rao, When comparing strings using eq, the match has to be exact to succeed. For the data line:
your regex is capturing $2 as "8" (a single character, no initial space). So when you come to compare it:
the match fails. Two useful references: But please follow choroba’s advice and use a hash lookup instead of a regex for this kind of conversion. Remember the Perl motto: when in doubt, use a hash! :-) Hope that helps,
In Section
Seekers of Perl Wisdom
|
|