Simpler approach may be this my $path='C:\Documents and Settings\anish\Desktop\Design Documen1.doc'; my @a=split(/\\/,$path); print join "\n",$a[$#a];
Thanks, a b On 3/28/06, Xavier Noria <[EMAIL PROTECTED]> wrote: > > On Mar 28, 2006, at 11:31, Anish Kumar K. wrote: > > > How to extract the path of the file name in perl > > > > say > > my $path="C:\Documents and Settings\anish\Desktop\Design > > Documen1.doc"; > > $path=~ m/([^\/\\]+)$/; > > $path= $1; > > print "The Path is : $path"; > > Have a look at the standard module File::Basename. > > -- fxn > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > >