Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: finding all combinations

by Anonymous Monk
on Jan 13, 2008 at 21:50 UTC ( #662218=note: print w/replies, xml ) Need Help??


in reply to finding all combinations

Also, your loop comparison should be $i <= $#array1 or $i < @array1, not $i <= $array1, which tries to compare $i to some (probably newly created) scalar $array1.

Strong Suggestion: always use warnings; and use strict;, which would have alerted you to some, at least, of the errors noted.

Another Suggestion: try using the Perl-style rather than the C-style for loop:

for my $i (@array1) { for my $j (@array2) { ... } }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2020-10-29 14:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (271 votes). Check out past polls.

    Notices?