Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: two dimensional array lookup

by tos (Deacon)
on Jul 17, 2003 at 13:55 UTC ( [id://275215]=note: print w/replies, xml ) Need Help??


in reply to two dimensional array lookup

when i saw simonms great solution i was ashamed of my own. But since it was a little trouble for me and because of TMTOWTDI here my approach.

use strict; use warnings; use Data::Dumper; my @erg; my @all=(["what", "is", "the", "matrix"],["matrix", "reloaded", "is", +"no", "good"]); print "\n",Dumper(\@all); for (my $i = 0; $i < @{$all[0]}; $i++) { for (my $j = 0; $j < @{$all[1]}; $j++) { $erg[0][$i] ||= sprintf "%u", ($all[0][$i] eq $all[1][$j]); $erg[1][$j] ||= sprintf "%u", ($all[0][$i] eq $all[1][$j]); } } print "\n",Dumper(\@erg);
greetings, tos

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://275215]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-28 23:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found