Mauricio Lairet P. wrote:

> Hi!
> 
> I have this line for example:
> 
> c:\dir\subdir\subsubdir\subsubsubdir\file.ext
> 
> and another line:
> 
> d:\dir\file2.ext
> 
> How can I strip the root and dirs address and just keep the name "file.ext"
> and "file2.ext"?


You could use File::Basename or a RE:

my $path = 'c:\dir\subdir\subsubdir\subsubsubdir\file.ext';
(my $basename = $path) =~ s/^.*[\\\/]//;
print "$basename\n";

-- 
   ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
  (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to