in reply to Unexpected Behavior - Variables and Regex

OK, I did some googling for "Perl remove newline" and came across a technique that worked where chomp failed. Instead of "chomp($hostname)", I used this regex:

$hostname =~ s/\R//g;

Now when I run my code, the regex match and the print output all works as expected. I hope this can help someone else in the future!!

ImJustAFriend

Replies are listed 'Best First'.
Re^2: Unexpected Behavior - Variables and Regex
by kcott (Archbishop) on Jan 13, 2014 at 14:49 UTC

    Just some additional information:

    -- Ken