in reply to Re^2: Problems with changing $/ and Tie::File in RO mode (:crlf)
in thread Problems with changing $/ and Tie::File in RO mode
does it also work with the 'Tie::File' to an @array?
Yes. For example, to read Windows-style files on Unix:
#!/usr/bin/perl use Tie::File; my $fname = shift @ARGV; open my $fh_crlf, "<:crlf", $fname or die "Couldn't open '$fname': $!" +; tie my @array, 'Tie::File', $fh_crlf, mode => O_RDONLY, memory => 0 or + die $!; for my $line (@array) { # ... # $line has no trailing \r }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Problems with changing $/ and Tie::File in RO mode (:crlf)
by Ooops (Initiate) on Oct 02, 2009 at 12:39 UTC |