in reply to How to replace the cut command from cshell in Perl

File::Basename is the best way to go, but sometimes if I'm feeling particularly obtuse, I might use something like:</>

my $file = (split(/\//, $path))[-1];

I don't recommend it tho :)

--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me

Replies are listed 'Best First'.
Re: Re: How to replace the cut command from cshell in Perl
by a (Friar) on Jan 20, 2001 at 10:33 UTC
    or:
    @parts = split(/\//); $file1 = pop @parts;
    in case the parts might be useful later, but YMMV (may want to chomp if there's a \n on there) - not wildly recommended either.

    a