in reply to File handling basics
I made a few additional changes reflecting the currently widely accepted good practices.my $dir = "/temp/"; for my $file (glob "$dir/*") { next unless -f $file; # process only regular files, not dirs open (my $F, $file) or die "cannot open file $!"; while (<$F>){ print $_; } close $F; } # closedir(DIR); -- not needed with glob
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: File handling basics
by Monk::Thomas (Friar) on Jul 17, 2015 at 15:15 UTC | |
by Laurent_R (Canon) on Jul 17, 2015 at 17:58 UTC | |
|
Re^2: File handling basics
by marinersk (Priest) on Jul 17, 2015 at 20:59 UTC |