Jemand zu Hause?
Wie frage ich & perlintro
brian's Leitfaden für jedes Perl-Problem1 2 3 4 5 6 7 8
{ local $/ = "\012"; open my $fh, "<", "file.csv" or die $!; while (my $line = <$fh>) { chomp $line; # linefeed entfernen ... } }
Wie frage ich & perlintro
brian's Leitfaden für jedes Perl-Problemopen(my $fh, "<:crlf", "dateiname") or die $!;
perlport unter dem punkt Newlines.1
2
3
4
5
6
7
8
9
10
11
12
13
14
Some of this may be confusing. Here's a handy reference to the ASCII CR and LF characters.
You can print it out and stick it in your wallet.
LF eq \012 eq \x0A eq \cJ eq chr(10) eq ASCII 10
CR eq \015 eq \x0D eq \cM eq chr(13) eq ASCII 13
| Unix | DOS | Mac |
---------------------------
\n | LF | LF | CR |
\r | CR | CR | LF |
\n * | LF | CRLF | CR |
\r * | CR | CR | LF |
---------------------------
* text-mode STDIO
Wie frage ich & perlintro
brian's Leitfaden für jedes Perl-Problem