William M West wrote:
Gunnar Hjalmarsson wrote:
William M West wrote:
ah!! i was so used to that /not/ being the case with a normal
filehandle
Don't understand. Which syntax(es) are you referring to when
saying that?
my @array =grep {-d "$directory\/$_"} readdir <LS2>;
gives me this error::
Type of arg 1 to readdir must be HANDLE (not <HANDLE>) at
./subdirs.pl line 30, near "<LS2>;"
Execution of ./subdirs.pl aborted due to compilation errors.
but of course that's NOT the same as :
my @array =grep {/foo/} <LS2>;
Right. readdir() expects a DIRHANDLE as the argument, while grep()
expects a LIST as the second argument.
which is fine- my careless reading of my other code got the misuse
of <> stuck in my head- that kept me from seeing the proper
solution.
Make it a habit to study the docs for the functions you are using:
perldoc -f grep
perldoc -f readdir
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>