2011-11-13T14:28:47 chmod777s~ = /\n$//g;
Quotes~ = /\n$//g;
$something =~ s/\n+$//;
$something =~ s|(?:\Q$/\E)+$||;
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/usr/bin/perl # vim: set ts=4 sw=4 et sta: use strict; use warnings; # DOS line my $line = "Hallo Welt.\x0d\x0a\x0d\x0a"; print "Start: ", $line; while ( $line =~ m/\n$/ ) { chomp $line; } print "Stop: ", $line;
1
2
3
4
$ perl linebreak.pl | xxd
0000000: 5374 6172 743a 2048 616c 6c6f 2057 656c Start: Hallo Wel
0000010: 742e 0d0a 0d0a 5374 6f70 3a20 4861 6c6c t.....Stop: Hall
0000020: 6f20 5765 6c74 2e0d 0a0d o Welt....
while (chomp) {}
2011-11-14T09:03:38 DubuOh, dann doch schon lieber
;-)Code (perl): (dl )while (chomp) {}
QuoteWhen in paragraph mode ("$/ = """), it removes all
trailing newlines from the string.