S
Shane
This module has scope issues, but I dont understand how
sub fork_guess {
my $puzzle = shift;
my $element_counter;
my %counted_hash;
my @array_keys;
my ($a, $b);
#Step 1
#loop through everything and find the first key with the lowest value
#ie, the first one with 2 values, or the first with 3
foreach my $listspot(@row_list){
foreach my $element(@{$listspot}){
if ( ref ($puzzle->{ $element }) eq "ARRAY") {
for ($counter=0;$counter <=8;$counter++){
if (defined $puzzle->{$element}[$counter]){$element_counter++}
}
line 234 %counted_hash{$element} = $element_counter;
}
}
}
238 @array_keys = sort {%counted_hash{$a} cmp %counted_hash{$b}}
keys %counted_hash;
print "ARRAY OF KEYS @arra_keys ##";
}
__EOF__
and these are the errors
syntax error at ./attempt3.pl line 234, near "%counted_hash{"
Global symbol "@array_keys" requires explicit package name at ./attempt3.pl
line 238.
Global symbol "%counted_hash" requires explicit package name
at ./attempt3.pl line 238.
syntax error at ./attempt3.pl line 238, near "%counted_hash{"
Global symbol "%counted_hash" requires explicit package name
at ./attempt3.pl line 238.
Execution of ./attempt3.pl aborted due to compilation errors.
sub fork_guess {
my $puzzle = shift;
my $element_counter;
my %counted_hash;
my @array_keys;
my ($a, $b);
#Step 1
#loop through everything and find the first key with the lowest value
#ie, the first one with 2 values, or the first with 3
foreach my $listspot(@row_list){
foreach my $element(@{$listspot}){
if ( ref ($puzzle->{ $element }) eq "ARRAY") {
for ($counter=0;$counter <=8;$counter++){
if (defined $puzzle->{$element}[$counter]){$element_counter++}
}
line 234 %counted_hash{$element} = $element_counter;
}
}
}
238 @array_keys = sort {%counted_hash{$a} cmp %counted_hash{$b}}
keys %counted_hash;
print "ARRAY OF KEYS @arra_keys ##";
}
__EOF__
and these are the errors
syntax error at ./attempt3.pl line 234, near "%counted_hash{"
Global symbol "@array_keys" requires explicit package name at ./attempt3.pl
line 238.
Global symbol "%counted_hash" requires explicit package name
at ./attempt3.pl line 238.
syntax error at ./attempt3.pl line 238, near "%counted_hash{"
Global symbol "%counted_hash" requires explicit package name
at ./attempt3.pl line 238.
Execution of ./attempt3.pl aborted due to compilation errors.