J
JB
I am trying to use the AI::Genetic module, but I cannot
figure out how to access data it is passing. In short,
to use the module, it is necessary to write a 'fitness'
function that will be passed an anonymous list. I can't
seem to properly access the passed list.
Here's an example:
sub fitness()
{
print Dumper(@_);
}
results in:
$VAR1 = [
1,
0,
1
];
Yet if I try:
sub fitness()
{
@temp = @_;
print $temp[0];
}
I get:
ARRAY(0x18343d8)
The only way I can view the passed list is by
using 'Dumper' but that doesn't do me much good.
How do I access the elements of the passed list?
Thanks in advance for any responses.
figure out how to access data it is passing. In short,
to use the module, it is necessary to write a 'fitness'
function that will be passed an anonymous list. I can't
seem to properly access the passed list.
Here's an example:
sub fitness()
{
print Dumper(@_);
}
results in:
$VAR1 = [
1,
0,
1
];
Yet if I try:
sub fitness()
{
@temp = @_;
print $temp[0];
}
I get:
ARRAY(0x18343d8)
The only way I can view the passed list is by
using 'Dumper' but that doesn't do me much good.
How do I access the elements of the passed list?
Thanks in advance for any responses.