On Sep 21, 5:03 pm, [EMAIL PROTECTED] (Santana) wrote:
> Hei all,
> how  print a hashtable elements in a function that receives the
> reference of
> this hastable  ???
>
> In this example this foreach loop in "printHT" function  dont work ,
> how is missed ?
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> sub printHT($)
> {
>    my $T =$_[0];
>
>    foreach my $id (keys (%$T)){           #This dont work :)
>
>     print $$T{$id} . "\n";
>    }
>
> }
>
>  my %ht_state=("AL" => "Alabama","AK" => "Alaska");
>  &printHT(\%ht_state);

Hmm? That actually does seem to work: I get

ben ~ 507 $ ./hashtest.pl
Alabama
Alaska
ben ~ 508 $

(I've called this script "hashtest.pl".)

Were you expecting some other thing to be output?

The version of perl is as follows:

ben ~ 508 $ perl --version

This is perl, v5.8.8 built for i486-linux-gnu-thread-multi


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to