Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: grep and dereferencing an array of arrays

by BillKSmith (Priest)
on Sep 07, 2013 at 14:41 UTC ( #1052816=note: print w/replies, xml ) Need Help??


in reply to grep and dereferencing an array of arrays

use strict; use warnings; my $qablock = [ [qw(r0c0 r0c1 r0c2)], [qw(r1c0 r1c1 r1c2)], [qw(r2c0 r2c1 r2c2)], ]; my $answer = 'r1c0'; my ($usefulans) = grep {$$_[0] eq $answer} @$qablock; print "\t\t----> @$usefulans\n";
Output:
----> r1c0 r1c1 r1c2
Bill

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1052816]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2017-03-30 01:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (353 votes). Check out past polls.