in reply to Re^2: how to append 2 lines
in thread how to append 2 lines
May I suggest something like this to read your lines of text:
use feature ":5.14"; use warnings FATAL => qw(all); use strict; use Data::Dump qw(dump pp); sub readFile($) {my ($f) = @_; $f or die "readFile: No file specified"; open my $F, "<$f" or die "Cannot open $f for input"; local $/ = undef; <$F> } print readFile("readFile.pm");
Produces:
use feature ":5.14"; use warnings FATAL => qw(all); use strict; use Data::Dump qw(dump pp); sub readFile($) {my ($f) = @_; $f or die "readFile: No file specified"; open my $F, "<$f" or die "Cannot open $f for input"; local $/ = undef; <$F> } print readFile("readFile.pm");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: how to append 2 lines
by suno (Acolyte) on Sep 10, 2012 at 10:26 UTC |