in reply to grep and dereferencing an array of arrays
Hi,
you have an error here:
my $usefulans = grep { $$_[ 0 ] eq $answer } @$qablock;
With the assigmnent to $usefulans you force scalar context. That means you assign the length of the resulting grep operation to this variable. Afterwards you try to derefence it. I'm pretty sure that with strict and warnings you would have got the right hints.
Update: my $usefulans = [ grep { $$_[ 0 ] eq $answer } @$qablock ]; should solve your problem.
Best regards
McA
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: grep and dereferencing an array of arrays
by Eily (Monsignor) on Sep 06, 2013 at 20:42 UTC | |
by McA (Priest) on Sep 06, 2013 at 21:03 UTC | |
by oakb (Scribe) on Sep 08, 2013 at 22:54 UTC | |
|
Re^2: grep and dereferencing an array of arrays
by oakb (Scribe) on Sep 06, 2013 at 19:02 UTC | |
by McA (Priest) on Sep 06, 2013 at 19:06 UTC | |
by oakb (Scribe) on Sep 06, 2013 at 19:35 UTC | |
by McA (Priest) on Sep 06, 2013 at 20:34 UTC | |
by choroba (Cardinal) on Sep 06, 2013 at 21:04 UTC | |
| |
by Marshall (Canon) on Sep 07, 2013 at 09:25 UTC |