in reply to Directory name as command line argument

use strict; use warnings; use Fatal qw(chdir open); my ($dir_name) = @ARGV; chdir $dir_name; for my $file (grep {-f} glob '*') { open my $reader, '<', $file; print "Just opened $file.\n"; while (<$reader>) { # Did you want to do anything besides read the file? } print "Just finished reading $file.\n"; }

Replies are listed 'Best First'.
Re^2: Directory name as command line argument
by max210 (Novice) on Mar 27, 2008 at 18:05 UTC
    Nice code, great help, Thanks you very much :) Have to do some pattern matching in each file and few other stuff, its simple......thanks again :)