in reply to Junking excess string.. junk with s///.

You have to keep in mind that you are replacing a portion of the string, not the whole thing. Only the portion you match is replaced.

Your code just removes the first newline. You are matching anything from the beginning up to and including the first newline and replacing with everything you match excepting that newline. Consider "foo\nbar\n". You replace "foo\n" with "foo" leaving "foobar\n".

It seems that what you really want is something like this:

$val =~ /(.*)/ and $val = $1;
or
$val = ( $val =~ /(.*)/ )[0];

Edit: Changed wording for clarity.

-sauoq
"My two cents aren't worth a dime.";