i'm trying to pull a slice out of a hashref of an arrayref and i'm failing. here's what i have:
print join(',', @{ $uword{ $seen{ $key }[ 1 ] }[ 1 .. $#{ @uword{ $see +n( $key ) } } ] } );
what perl is telling me is:
Global symbol "$seen" requires explicit package name at ./namevsfield. +pl line 105. syntax error at ./namevsfield.pl line 105, near "$seen( " syntax error at ./namevsfield.pl line 107, near "}" Execution of ./namevsfield.pl aborted due to compilation errors.
line 105 is above and line 107 closes my for my $key (keys %seen) { loop. these two variables were defined with:
andforeach my $string ( @word ) { if ( $uword{ $string }[ 0 ] == 1 ) { push @{ $uword{ $string } }, $line; next; } $uword{ $string }[ 0 ] = 1; push @{ $uword{ $string } }, $line; }
foreach my $string ( @data ) { # dedupe data and sanity check. next if !defined ($string); # should never be true. next if $seen{ $string }[ 0 ] == 1; # check %seen hash / array f +or dupe $seen{ $string }[ 0 ] = 1; # define hash of array and assign +check to it. $seen{ $string }[ 1 ] = $key; # add word from line to hash for r +eference. }
where i'm taking out dupes and appending where the data came from to a hashref of the hash. then i need to print out all of the data. i have no issues with posting the code if need be, i just didn't think it necessary. any help would be greatly appreciated. thanks
In reply to error joining hashref of an arrayref by ag4ve
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |