Re: [Perl-unix-users] Greedy Matching

2004-03-17 Thread Murugavel Chidambaram
See the below code. It give you the correct output. #!/usr/bin/perl my $str = "/var/tmp/test/stuff"; ## replace 'test/stuff' to 'test_stuff' ## $str =~ s/\//\_/; $str =~ s/test\/stuff/test_stuff/; print $str,"\n"; Regards C.M +++ Statutory Reporting IT,

RE: [Perl-unix-users] Greedy Matching

2004-03-17 Thread Darrell Gammill
Your only matching on the first occurrence. Add a 'g' modifier to it to make it repeat the substitution for the entire string. $str =~ s/\//\_/g; -Dgg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Parvez Pathan Sent: Wednesday, March 17, 2004 11:00 PM

[Perl-unix-users] Greedy Matching

2004-03-17 Thread Parvez Pathan
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. my $str = "/var/tmp/test/stuff"; ## replace 'test/stuff' to 't