I've got a string with a New Line/carraige return in it and I'm trying to remove it. I thought it was like this:<br>$TheString=~s/.//s;<br>but I'm incorrect.<br>Does anyone know how to do this?<br><br>Thanks,<br>Huck Finn
I think the trim() function trims the whitespace.. I know there's a function that does it. Try trim(). <p>Liam Morley<br><a href=mailto:lmorley@wpi.edu>lmorley@wpi.edu</a><br><a href=
If the newLine/CarriageReturn is at the end of the $str, <br><FONT FACE=monospace>chomp($str);</font><br><br>If the newLine/CarriageReturn is embedded in the $str, <br><FONT FACE=monospace>$str =~ s/\n¦\r//g;</font><br><br>'hope this helps.... <p> <br><a href=mailto: > </a><br><a href= > </a><br> keep the rudder amid ship and beware the odd typo
think you have to set $*=1 as well so that perl does pattern matching on string with embedded new-line characters <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href=
Your right Mike,.....I left out a switch....<br><br>an alternative to $* =1 is using the 's' switch in a the match.....<br><br><FONT FACE=monospace>$str =~ s/\n¦\r//sg;</font> <p> <br><a href=mailto: > </a><br><a href= > </a><br> keep the rudder amid ship and beware the odd typo
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.