On 7/9/01 11:43 AM, "Katherine Richmond" <[EMAIL PROTECTED]>
wrote:
> Hi all,
>
> Is there a method that will return the file name from a full path? Users can
> drop multiple images on a droplet and then I need to question them about the
> file name. When I run this code, the full path is printed. Do I have to use
> split or something and get the name myself? I've been reading the MacPerl book
> and do not see an example of this.
>
> foreach my $f ( @ARGV ) {
>
> print "$f\n";
>
> }
>
#/usr/bin/perl
use File::Basename;
foreach my $file (@ARGV) {
my $basename = basename($file);
print STDOUT $file,"\t",$basename,"\n";
}
If you need the path and the filename, check out fileparse in File::Basename
--
Todd Richmond http://cellwall.stanford.edu/todd
Carnegie Institution email: [EMAIL PROTECTED]
Department of Plant Biology fax: 1-650-325-6857
260 Panama Street phone: 1-650-325-1521 x431
Stanford, CA 94305