Hello Rory,

Saturday, August 25, 2001, Rory O'Connor <[EMAIL PROTECTED]> wrote:

ROC> thanks all for your help.  It is my understanding that chomp($var); will
ROC> only strip the \n from the end of a string.  I'm dealing with strings
ROC> that could potentially be littered with newline characters.
well... then you have multiple strings stored in one variable? yes,
chomp won't help you here.
ROC>   I have an
ROC> o'reilly perl book, but it's not super clear on how to strip *all*
ROC> newline characters out of a string, no matter where they are.  am i
ROC> right in assuming regex needed for this?
in perl way, yes. something like

$a="a\nb\nc\nd\n\n\n";
$b=$/;
$a =~ s/$b//g;

alternativelly, you can take a look at
perldoc -f substr

Best wishes,
 Maxim                            mailto:[EMAIL PROTECTED]

p.s. does anyone know, why i can not write "$a =~ s/$///g;" ?



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to