It's not pretty or elegant but it does get the job done:

$str = "abc.def.ghi.jkl.mno";
@parts = split /\./, $str;
for ($i=0; $i<$#parts; $i++) {
    $new_str .= "$parts[$i]_"; }
$new_str .= ".$parts[-1]";

Matthew Schneider
System Administrator / Programmer
SKLD Information Services, LLC
303.820.0863


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of
mario sanchez
Sent: Thursday, May 27, 2004 5: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