I would try 

$string2 = $string1;
$string2 =~ s%[-\.]%/%;

Matt Schneider 
Programmer/System Administrator 
SKLD Information Services, LLC 



-----Original Message-----
From: Jon Shorie [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 8:27 AM
To: [EMAIL PROTECTED]
Subject: [Perl-unix-users] Trying to change some punctuation in a string


I am hitting a mental block on this.  I know that it is probably simple, but
I 
will ask anyway.  I am trying to convert a string of the form:

$string1 = "900/00-2.3"

to 

$string2 = "900/00/2/3"

Here is what I have so far:


($n1,$r2) = split(/-/, $string1);
($n2,$n3) = split(/./, $r2);
$string2 = $n1 . "/" . $n2 . "/" . $n3;
$string3 = $n1 . "/" . $r2
If I then print out $string2, I get

900/00//

If I print out $string3, I get

900/00/2.3

any ideas?

_______________________________________________
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