if($path =~ /(\d+)$/ == 0) { print "No number found\n"; } else { print "number is $1\n"; }