I might not be understanding you properly, but...
$line =~ m/^2:/ will test the first 2 characters of $line and does not change $line. If you use $line after matching, it will have the same value as it had before matching. So if $line was 2:06/06/07 15:49 before the match, it is still 2:06/06/07 15:49 after the match.
If you want to know what happens during a match, perl sets several variables you can use after the match statement. Perl sets
$` to the string preceding the match, it sets
$& to the string that was matched and it sets
$' to the string following what was matched. For the example of
2:06/06/07 15:49 this is what they would be:
Code:
$` would be the empty string at the start of the line
$& would be 2:
$' would be 06/06/07 15:49
$line would be 2:06/06/07 15:49
Using these variables can cause a performance hit, so test them if you want to use them with large files.
Hope that helps...