Parvez,

I was a little unclear what you wanted, but judging
from your comment, you only want to replace / with _
on the last occurance of /:

see 'perldoc perlre' for the nitty gritty
also 'perldoc perlretut'


== code ==

#!/usr/bin/perl
                                                      
                         
use strict;
use warnings;
                                                      
                         
my $str = '/var/tmp/test/stuff';
                                                      
                         
$str =~ s|/(?!.*/)|_|g;
                                                      
                         
print "$str\n";

=============


--- Parvez Pathan <[EMAIL PROTECTED]> wrote:
> 
> Hi All,
> 
>   I am having a small doubt with the greedy pattern
> matching of Perl. We all know that Perl will try to
> match as many times as it can. But I am not getting
> the correct results. Please let me know if I am
> making a mistake.
> 
> <CODE>
> my $str = "/var/tmp/test/stuff";
> 
> ## replace 'test/stuff' to 'test_stuff'
> 
> $str =~ s/\//\_/;
> 
> print $str,"\n";
> 
> </CODE>
> 
> But this gives me the result as
>           "_var/tmp/test/stuff"
> 
> Can anybody tell me what is wrong?
> 
> 
> Regards,
> Parvez
> 
> 
> 
> 
> 
>
____________________________________________________________
> Find what you are looking for with the Lycos Yellow
> Pages
>
http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10
> _______________________________________________
> Perl-Unix-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe:
http://listserv.ActiveState.com/mailman/mysubs


=====
Anthony Ettinger
[EMAIL PROTECTED]
http://www.apwebdesign.com
Instant Messengers:
1) yahoo im: apwebdesign   2) aol im: apwebdesignxl
3) msn im: [EMAIL PROTECTED]   4) icq im: 659139

__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com
_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to