Code Comments
Programming Forum and web based access to our favorite programming groups.Hi,
I am getting some errors. I am not able to figure that out. I feel the code
is right.I am passing an array into a subroutine and building a hash dependi
ng upon the values( grouping index with common values).
I see that some of the values are not stored in the array while printing it.
I am pasting that section of code here.
my($ent) = @_;
my %assos= ();
my @e = @$ent;
no strict 'refs';
my $i = -1;
foreach my $ev (@e){
$i++;
if(exists($assos{$ev})){
#here the value '0' '2' '4' '11' etc are not pushed but its entering the loo
p
push @{$assos$ev}},"$i";
print("@{$assos{$ev}}\n");
} else{
$assos{$ev} = "$i";
print(" @{$assos{$ev}}\n");
}
}
foreach my $ev ( keys %assos ) {
print "$ev: @{ $assos{$ev} }\n";}
Can anyone of you let me know what went wrong. and how to solve it.
Thank You
Asha
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.