Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by haukex (Archbishop)
on Nov 25, 2017 at 16:18 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-03-29 00:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found