in reply to
Simple Regex needed
With
$path = "/usr/local/bin/foo"
..
my $foo = ( split ( "/", $path ) )[ -1 ];
my $foo = ( $path =~ m"/(\w+)$" )[ 0 ];
There are also modules that will take care of this for you ..
File::Spec
is one of them.
--t. alex
Life is short: get busy!
Comment on
Re: Simple Regex needed
Select
or
Download
Code
In Section
Seekers of Perl Wisdom