Hi Al,
Thanks a lot!! I have been able to solve my problem and have also learnt a lot from
all these inputs.
Thanks once again.
Parvez
--
- Original Message -
DATE: Thu, 18 Mar 2004 08:02:41
From: "Elston, Jeremy" <[EMAIL PROTECTED]>
To: "'[EMAIL PROTECTED]'" <[EMAIL PROTEC
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
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,
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