Log in

View Full Version : Perl hash



neo_philiac
08-13-2008, 02:19 PM
Stupid question but I want to add multiple elements into a hast not just a pair:

So,




chomp($fill{1} = ("Host_1","hostname_1"));



if I do this and then try to print with


foreach $key (sort keys %fill) {

print "\n".$key."\t".$fill{$key}.$fill{$value}."\n\n";

}


I get :


1 hostname1

I am trying to associate two elements into one key. What am I doing wrong?

I want :



1 Host_1 hostname1



Thanks

TheJoshMan
08-13-2008, 02:52 PM
You will probably have better luck with PERL questions in another forum somewhere... I still have a PERL question which never got answered in these forums. I think there aren't many people here who know PERL. I gave up and used PHP instead.