in reply to reading files from a directory
You must not have blanks between the filehandle and the angle-operator (because then the angle-operator sees the blanks, finds that this is not a filehandle and tries to glob it.
You first attempt shoud be ok as long as you do it like this:
And while we are at it the second form (using a lexical variable rather than a package-filehandle) is considered to be better style and you should also use the 3-arg form of open:while ( <IN> ){ # no blanks araound IN ... while ( <$fh> ){ # dito
open (IN, "<", $dir/$file")
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: reading files from a directory
by kevyt (Scribe) on Oct 28, 2010 at 05:50 UTC | |
by johngg (Canon) on Oct 28, 2010 at 08:42 UTC |