in reply to Remove newline character from start of string

To remove all new lines within $line:
$line =~ tr/\n//d;

$line =~ s/^\n//; #remove leading one
$line =~ s/\n$//; #remove last one or better use chomp($line)

  • Comment on Re: Remove newline character from start of string