Title: Regular expression question
hi wagner,
 
try this:
 
#/perl -w
 
$file = 'c:\temp\zips\foo\foo2\foo3\ok.txt';
@pa = split (/\\/, $file);
$file = $pa[$#pa];
 
 for $i (0..($#pa-1)) {
  $dir .= "$pa[$i]\\";
 }
 
print "directory: $dir\n";
print "file: $file\n";
 
 
fabrício s. martins
-----Mensagem original-----
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]Em nome de Wagner, David --- Senior Programmer Analyst --- WGO
Enviada em: terça-feira, 1 de agosto de 2006 16:37
Para: Cai, Lucy (L.); perl-win32-users@listserv.ActiveState.com; perl-unix-users@listserv.ActiveState.com; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Assunto: RE: Regular _expression_ question

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cai, Lucy (L.)
Sent: Monday, July 31, 2006 17:21
To: Cai, Lucy (L.); perl-win32-users@listserv.ActiveState.com; perl-unix-users@listserv.ActiveState.com; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Regular _expression_ question


I have a file such as:

My $file = "c:\temp\zips\ok.txt";

How can I split the $file to get the only path:

My $dir = "c:\temp\zips";
My $file = "ok.txt";

Thanks in advance!

Lucy  

Better to use File::Basename which will break it out for you. Comes as part of std Perl.

Wags ;) 

**********************************************************************

This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited.

**********************************************************************

 

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to