in reply to checking the end of line
One other thing to note is that this'll check for one *digit* at the end of your string, so if your end number might go into double figures remember to stick a '+' sign into your regex:if ($path =~ m/(\d+)$/) { my $end_num = $1; if ($end_num == 0) { etc. } and so on for other numbers } else { print "Oh dear, my path doesn't end with a number\n"; }
Hope that helpsm/(\d+)$/
|
|---|