Mario,

This will do what you're wanting:

1. #!/usr/bin/perl
2. 
3. $string = "abc.def.ghi.jkl";
4. print "pre-sub: $string\n";
5.
6. $string =~ s/\./_/g;
7.
8. print "post-sub: $string\n";

Note line 6 is what actually does the substitution.  You have to escape the
period because Perl will think you're trying to join something as in:

Print "some string" . $variable . "more string here\n";

Good luck!

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of mario
sanchez
Sent: Thursday, May 27, 2004 7:50 AM
To: [EMAIL PROTECTED]
Subject: [Perl-unix-users] sub all but last

help for a novice (going crazy)

i cant seem to find the sequence to substitute all "." with "_" EXCEPT for
the last one

ex. change abc.def.ghi.jkl.mno
    to     abc_def_ghi_jkl_.mno

any help or pointers please?
thank you
mario

_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to