in reply to Using Split function.
my $path = "/path/ending/with/a/filename"; my $file = (split(/\//,$path))[-1]; print "$file\n";
OR
use File::Spec; my $fullpath = "/path/ending/with/a/filename"; my ($volume, $path, $file) = File::Spec->splitpath($fullpath); print "$file\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using Split function.
by vinoth.ree (Monsignor) on Aug 04, 2009 at 03:38 UTC |