in reply to Globbing uncertainty

Never, ever use <> for globbing. Always always use glob instead. Gets rid of all ambiguity.

As jethro said, your variable name implies that it's just a directory you're getting, so you still have to add the "/*.type" inside your code. If the user is passing in the * on the command line, then what you have would work if you switched over to glob. What you have right now looks to me like the perl compiler is treating $path_to_dir as if it were a filehandle and trying to read all lines from that filehandle. Using glob eliminates the confusion.

Replies are listed 'Best First'.
Re^2: Globbing uncertainty
by ikegami (Patriarch) on Nov 11, 2010 at 18:53 UTC

    If the user is passing in the * on the command line, then what you have would work if you switched over to glob.

    Assuming it was quoted. If it wasn't quoted, and one isn't using the Windows command shell, the shell would have done the globbing itself.

    $ perl -E'say for @ARGV' 'tmp/*' tmp/* $ perl -E'say for @ARGV' tmp/* tmp/a tmp/b tmp/c tmp/d tmp/e