[EMAIL PROTECTED] wrote:
Hello

Hello,

I have a string that contains a full path and file name. What is
the  easiest way to extract the file name? For example the path is
/dir1/dir2/dir3/file.txt.

$ perl -le'

use File::Basename;

my $full_path = q[/dir1/dir2/dir3/file.txt];

my $file_name = basename $full_path;

print $file_name;

'
file.txt



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to