in reply to regular expression
my $string = '~/tmp/hfj/abc/bhd/5009.xmlreal.xml'; $string =~ s/^.*\/\d+//; print "$string\n";
Another way is to use File::Basename to extract the file name, and then remove the bits you don't want.
use File::Basename; $string = '~/tmp/hfj/abc/bhd/5009.xmlreal.xml'; my ($filename, $directories, $suffix) = fileparse($string); $filename =~ s/^\d+//; print "$filename\n";
Cheers,
Darren
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: regular expression
by AnomalousMonk (Archbishop) on Feb 28, 2010 at 05:57 UTC | |
by McDarren (Abbot) on Feb 28, 2010 at 06:04 UTC |
In Section
Seekers of Perl Wisdom