It looks like you just forgot to escape one of your pipes, but I would use translate myself. Should be more efficient.
$string =~ tr[|][|]s; To (s)queeze out the extra characters. Jeremy Elston Sr. Staff Unix System Administrator Charles Schwab & Co., Inc. "The Jim Conspiracy IS real! You will be assimilated!" WARNING: All email sent to this address will be received by the Charles Schwab Corporate email system and is subject to archival and review by someone other than the recipient -----Original Message----- From: Johnno [mailto:[EMAIL PROTECTED] Sent: Monday, April 05, 2004 7:46 AM To: [EMAIL PROTECTED] Subject: [Perl-unix-users] Some help with strings Hello All, I have a string that has got 1||||2||||3|4|||5 What I need it in is 1|2|3|4|5 I have tried $string =~ s/\||/\|/g; and i get this as a result |1|||||2|||||3||4||||5| what am i doing wrong? Mnay Thanks, Johnno _______________________________________________ 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