in reply to Re^2: How to read files in a directory, directory path to be given through CMD
in thread How to read files in a directory, directory path to be given through CMD

Ahh, so you do not intend STDIN, but rather @ARGV for your input. In that case, you might use
use strict; use warnings; foreach my $file (@ARGV) { if (-f $file) { print "This is a file: $file\n"; } if (-d $file) { print "\n\nThis is a directory: $file\n"; } }

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

  • Comment on Re^3: How to read files in a directory, directory path to be given through CMD
  • Download Code