in reply to Re: Can't use string ("query") as an ARRAY ref error
in thread Can't use string ("query") as an ARRAY ref error

Yeah , I have modified the code but my doubt is why it doesnot work when the query itself is "query".
it worked fine till the point where the query was like "abc" "perl" etc.
  • Comment on Re^2: Can't use string ("query") as an ARRAY ref error

Replies are listed 'Best First'.
Re^3: Can't use string ("query") as an ARRAY ref error
by ikegami (Patriarch) on Aug 28, 2009 at 02:49 UTC

    What you've showed us can't work if $query contains the string "query".

    To get into the "then" part, $hash{query} must contain the string "query", which will cause the following @{$hash{$query}} to fail.

    If you get into the "else" part, $hash{query} is set to the string "query", which will cause the following @{$hash{$query}} to fail.