Trying to do it right - My script uses symbolic references. I'd like to know how change it so that I'm using hard references and can use 'use strict' without errors.
The program receives a hash of hashes and then attempts to update the hash after the record has read.
my %hash=('1'=>{one=>""}, '2'=>{two=>"",zwei=>"",dos=>""}, '3'=>{three +=>"",tres=>""},'4'=>{four=>""},'5'=>{five=>""},6=>{six=>"",seis=>""}, +7=>{seven=>""}); my %subs; my $href; my $valCount=0; my $recCount=0; #get number of items foreach my $item (keys %hash) { print "count is " . (keys %{$hash{$item}}) . "\n"; $valCount+= (keys %{$hash{$item}}); } while($valCount > 0) { foreach my $id (sort keys %hash) { if(! exists $subs{$id}) { $href=$hash{$id}; foreach my $word (sort keys %$href) { next if(exists $$href{$word}{written}); $valCount--; print "$id $word\n"; $subs{$id}=""; $href->{$word}={written=>1}; last if((keys %{$hash{$id}}) > 1); } $recCount++; if($recCount == 4) { $recCount=0; %subs=(); } } } }
In reply to desire hard ref alternative by plevine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |