On 04/25/2007 11:59 PM, Nishi wrote:
On 4/25/07, Rob Dixon <[EMAIL PROTECTED]> wrote:
[...]
  my ($name) = $path =~ m|([^/]+)$|;


I tried it, but somehow doesnt work for me, printing $name returns me the
entire string such as C:\temp\abc\abc.txt and not abc.txt.
Am I missing something?


Backslashes should be excluded from the character class, and the backslash character has to be doubled because it is special.

my ($name) = $path =~ m|([^/\\]+)$|;



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


Reply via email to