in reply to regular expression

Another way using split.

$ perl -E ' > $str = q{~/tmp/hfj/abc/bhd/5009.xmlreal.xml}; > ( $path = ( split m{/}, $str )[ -1 ] ) =~ s{^\d+}{}; > say $path;' .xmlreal.xml $

McDarren's suggestion of File::Basename is probably the safest and most portable though.

Cheers,

JohnGG