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);