[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] getting filenames



>is it possible to get the "regular" filenames from @ARGV instead of the
>full pathnames which include every folder and volume down to the hard
>drive, separated by colons? for example, if i drop files called "file 1",
>"file 2", and "file 3" onto a droplet, i want to somehow get @somelist =
>("file 1", "file 2", "file 3"). if not, i guess i'll have to massage an
>@ARGV copy with substitution?
>
>thanks.

Hello,
      Add the line,

use File::Basename;

to the top (or thereabouts) of your script, then you can get the basename by

my($filename) = basename($full_filename);


Bob

________________________________________________________________
          Bob Wilkinson, Perl Programmer, Pindar plc
Tel: +44 (0)1904 613040    Email: B.Wilkinson@pindar.co.uk
Fax: +44 (0)1904 613110    URL: http://www.connection.co.uk/~bob
________________________________________________________________
    The views expressed herein are mine, and are not 
          necessarily shared by my employer.
________________________________________________________________