Re: Equivalent function to shell basename?
- --- In email@example.com, Tom Barron <tbarron@m...> wrote:
> Steve Milo wrote:basename
> > ...
> > use File::Basename;
> > $basename = basename(0);
> > >From what I remember there are a few fields that come up when
> > is used. 'basename(0)' refers to the name of the program thattried
> > 'executed' basename.
> > I havent used it for a while so I cant provide more details, I
> > perldoc -f basename on my system but it doesnt come up. Probablyperldoc
> > something wrong here.
> 'perldoc File::Basename' works for me. I think you have to give
> the whole name, including '::' and in the correct case.fileparse('/virgil/aeneid/draft.book7',
> From 'perldoc File::Basename':
> Using UNIX file syntax:
> ($base,$path,$type) =
> would yield
> $base eq 'draft'
> $path eq '/virgil/aeneid/',
> $type eq '.book7'
> The basename() routine returns the first element of
> the list produced by calling fileparse() with the
> same arguments, except that it always quotes
> metacharacters in the given suffixes. It is provided
> for programmer compatibility with the UNIX shell
> command basename(1).
I just tried 'perldoc File::Basename' and got the man pages! Thanks!