Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^7: Loading a part of the file to array using Tie::File

by haukex (Bishop)
on Nov 25, 2017 at 16:18 UTC ( #1204246=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    open my $ifh, '<', $file or die $!;
    chomp( my @a = <$ifh> );
    ...
    print $ofh $_,"\n" for @a;
    close $ofh;                      # vs.
                                           untie @a;
    
  2. or download this
    use Path::Class qw/file/;
    my @a = file($file)->slurp(chomp=>1);
    ...
    file($file)->spew_lines(\@a);
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1204246]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2022-05-20 11:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (73 votes). Check out past polls.

    Notices?