in reply to Re: Search an array ref of array refs
in thread Search an array ref of array refs

Yes, 'rowId' (actually domainId) is the first column in the table. Lemme expand on what I'm doing. I pull the $table, and then strip the first two columns into a hash, and the first column into a seperate array for the CGI::Form->query->popup_menu method:

my %labels = map { @$_->[0] => @$_->[1] } @$table; my $values = [map ( $_->[0] , @$table )];

Now I need to be able to say, give me the "row" from $table that has a domainId of, say 1. Then I can use the values from that row to fill textboxes for the selected domainId. The search code is great. I was just wondering if there was a way to do it w/ map to avoid the looping code. :)

Replies are listed 'Best First'.
Re: Re: Re: Search an array ref of array refs
by Fastolfe (Vicar) on Nov 01, 2001 at 09:33 UTC
    @found = grep { $_->[$column] == $searching_for } @$table;