Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Problem of referencing into subroutines.

by hipowls (Curate)
on Feb 18, 2008 at 22:27 UTC ( [id://668681]=note: print w/replies, xml ) Need Help??


in reply to Problem of referencing into subroutines.

This is not an answer but I am puzzled by your use of @indices. It contains the integers from 0 to 80 and is used in only one function

my @indices = ( 76, 46, 21, 15, 33, 20, 69, 65, 40, 11, 79, 22, 70, 43, 32, 30, 57 +, 19, 39, 37, 62, 3, 4, 44, 51, 58, 25, 72, 64, 59, 48, 80, 42, 38, 61 +, 75, 49, 1, 18, 71, 41, 2, 67, 13, 45, 60, 9, 7, 28, 6, 8, 54, 50 +, 73, 56, 53, 77, 27, 16, 29, 52, 10, 24, 5, 26, 36, 23, 34, 31, 47, 14 +, 35, 12, 55, 17, 0, 68, 74, 66, 78, 63 ); #number of the columns. ... sub genotype { my @seq; my @gene; my @string; push @gene, shuffle @indices; ... }
this can be rewritten as
my $max_index = 80; ... sub genotype { my @seq; my @gene = shuffle 0 .. $max_index; my @string; ... }
which makes your intent clearer and avoids the possiblity of missing an integer.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (8)
As of 2024-04-24 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found