Your RE $string =~ s/\||/\|/g;
First the second pipe is not escaped so it maintains its "or-ness" So the match part of your RE is backslash or nothing (or null/nil if you like) nil matches before and after each real character, for the matches or backslash you're simply substituting backslash Try This is what I think you want $string =~ s/\|+/\|/g; -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Johnno Sent: Monday, April 05, 2004 9: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