I\'m maintaining a script that can get its input from various sources, and works on it per line. Depending on the actual source used, linebreaks might be Unix-style, Windows
In your example, you can just go:
chomp(@lines);
Or:
$_=join("", @lines); s/[\r\n]+//g;
@lines = split /[\r\n]+/, join("", @lines);
Using these directly on a file:
perl -e '$_=join("",<>); s/[\r\n]+//g; print' );print @a'