my %hash = (
foo = 'bar'
);
my $name='hash';
my $key='foo';
print $name{$key};
how can I get that to print bar?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
The Ghost wrote:
my %hash = (
foo = 'bar'
);
my $name='hash';
my $key='foo';
print $name{$key};
how can I get that to print bar?
You can't, given the way you've set up %hash and $name. You're trying to
take a soft reference to a lexical variable, which won't work.
(well, you could
-Original Message-
From: The Ghost [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 16, 2005 8:00 PM
To: Perl Beginners
Subject: refs and variables
my %hash = (
foo = 'bar'
);
my $name='hash';
my $key='foo';
print $name{$key};
how can I get