Hello,
You can get the same functionality using glob operator(as LaurentR has said) and with fewer lines of code.
Here you go!
#!/usr/bin/perl my @files = glob( "$ARGV[0]/*.*" ); for my $file (@files) { open NB_FILE, '<', $file or die "Couldn't open Netbackup file!"; while(<NB_FILE>) { print "Printing line $. from file $file\n"; print $_; } close NB_FILE or die "Couldn't close the file properly!" }
In reply to Re: working with directories
by uday_sagar
in thread working with directories
by madM
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |