Thank you all! I figured it out!
Jim
2010/1/18 Alexander Koenig :
> 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
Thank you all! I figured it out!
JIm
2010/1/18 Alexander Koenig :
> 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/bi
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 longe
Jim Green wrote:
> my $name = "/usr/local/bin/perl";
> (my $basename = $name) =~ s#.*/##; # Oops!
>
#!/usr/bin/perl
use strict;
use warnings;
use File::Basename;
my $name = "/usr/local/bin/perl";
my $basename = basename( $name );
print "$basename\n";
--
Just my 0.0002 million dollars wo
Hi Jim,
>>but why it is not /local/bin/perl? will .*/ matches longest possible
string?
. means any character
* means preceding character any number of times (zero or more), so .*
means any character (but not a new line) any number of times
Now .*/ means any number of characters but should e
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?
Thank you list!
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional