Ben Crane wrote:
> 
> Hi all,

Hello,

> I'm trying to split apart a filepath...e.g:
> c:\test\abc\what\somefile.txt
> The length of the filepath will never be constant...


$ perl -le'
use File::Spec;

my $path = q[c:\test\abc\what\somefile.txt];

my ( $vol, $dir, $file ) = File::Spec->splitpath( $path );
print qq[ "$vol"  "$dir"  "$file" ];

my @dirs = File::Spec->splitdir( $dir );
print map qq[ "$_" ], @dirs;             
 
'
 "c:"  "\test\abc\what\"  "somefile.txt" 
 ""  "test"  "abc"  "what"  "" 



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to