Neatest way to remove linebreaks in Perl
问题 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-style or even, for some aggregated input, mixed(!). When reading from a file it goes something like this: @lines = <IN>; process(\@lines); ... sub process { @lines = shift; foreach my $line (@{$lines}) { chomp $line; #Handle line by line } } So, what I need to do is replace the chomp with something that removes either Unix