Leser: 29
my @lines = do { local $/; <$in> }; # slurp!
my $scalar = do { local $/; <$in> }; # slurp!
Guest SchlumpfHallo!
perlfaq 5
"How do I change, delete, or insert a line in a file, or append to the beginning of a file?"
7. Beispiel.
Für mich wäre es verständlicher wenn man statt:
Code (perl): (dl )my @lines = do { local $/; <$in> }; # slurp!
Code (perl): (dl )my $scalar = do { local $/; <$in> }; # slurp!
schreiben würde.
Guest SmurphSubject: Error of Perlfaq?
Hello Brian!
Concerning perlfaq 5
"How do I change, delete, or insert a line in a file, or append to the beginning of a file?"
7th example:
Code (perl): (dl )my @lines = do { local $/; <$in> }; # slurp!
which doesn't really make sense for me...
Wouldn't it make more sense to write
Code (perl): (dl )my $scalar = do { local $/; <$in> }; # slurp!
instead?
Bye
Smurph
my $scalar = do { local $/; <$in> }; # slurp!
1 2 3 4 5
my @lines = do { local $/; <$in> }; # slurp! my $new_first_line = "My new first line.\n"; unshift @lines, $new_first_line;