in reply to Re: tar sytem command
in thread tar sytem command

I'd be inclined to use:

use File::Basename; my $archive = "/some/dir/archive.tar.gz"; my ($filename, $dir) = fileparse($archive);

Of course you could argue that it's fairly safe to assume a system that has 'tar' installed probably also uses '/' for a directory separator :-)

Replies are listed 'Best First'.
Re^3: tar sytem command
by tadman (Prior) on Oct 29, 2002 at 07:38 UTC
    Good point. I was thinking there was a module, but couldn't make the mental leap past File::Path which is not what I was looking for.

    By the way, how do you find out what the directory separator is? Check $/ and guess?
      By the way, how do you find out what the directory separator is?

      File::Spec is another core module (comes with Perl) that can be used for file pathname manipulations such as splitting or combining a path into the individual directory componenets. File::Spec takes care of the details so you don't even need to worry what the directory separator is.