develooper Front page | perl.beginners | Postings from February 2002

help with scalar references

Thread Next
From:
Karthik Gurumurthy
Date:
February 7, 2002 10:55
Subject:
help with scalar references
Message ID:
NEBBJNMDEKBIBCMCNMBDIEOCDAAA.karthikg@aztec.soft.net
hi!

this is a simple program i wrote to understand references..

($a,$b,$c) = (\"1",\"2",\"3");

%hash = ($a=>"hello",$b=>"Perl");

foreach $key (keys%hash){
	$keyval = ${$key};
	print "$keyval\n";
	print ("The key is $$key and the value is $hash{$key}\n");
}


the output is:


The key is  and the value is hello

The key is  and the value is Perl

Why am i not able to print the key value using the reference?

thanks,
karthik



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About