Perfectly fine the way you wrote it - why involve a regexp when you got
an elegant solution? If you insist on a regexp, try this instead:
 
    $current_file = (split(/[/\\]/,$current_file))[-1];
 
Tobias
 
PS: How's Adobe treating you? ;-)

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
John Townsend
Sent: Friday, April 13, 2007 2:53 PM
To: [EMAIL PROTECTED]
Subject: Getting file name from a path



Often I need to extract the file name from a path. Typically I do
something like following. Any better ways I could do this?


#path test 
$current_file = "c:/somedir/test.ps"; 
@split_path = split("/",$current_file); 
$current_file = @split_path[-1]; 
print $current_file; 


However, I'm pretty sure I could extract the file name using a regular
expression. How might I do this? Any suggestions welcome.

Thanks 

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to