Thank you all! I figured it out!

Jim
2010/1/18 Alexander Koenig <alexander.koe...@mpi.nl>:
> Hi Jim,
>
> Jim Green wrote on 01/17/2010 05:25 PM:
>> my $name = "/usr/local/bin/perl";
>> (my $basename = $name) =~ s#.*/##; # Oops!
>>
>> after substitution $basename is supposed to be
>> perl
>>
>> but why it is not /local/bin/perl? will .*/ matches longest possible string?
>
> Yes it will match the longest possible string.
> To understand how this works (and how to avoid this behaviour if you
> don't want it) look into the concept of "greedy" regular expressions.
> For example here http://perldoc.perl.org/perlretut.html
>
> bye
> Alex
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to