ent: 3/31/02 5:04 AM
Subject: Re: Newbie Help please.
Sa wrote:
> #!/usr/bin/perl -w
> $map{"red"} = "apple";
> $map{"green"} = "grass";
> $map{"blue"} = "ocean";
> print "A string please: "; chomp ($some_string = );
&g
Sa wrote:
> #!/usr/bin/perl -w
> $map{"red"} = "apple";
> $map{"green"} = "grass";
> $map{"blue"} = "ocean";
> print "A string please: "; chomp ($some_string = );
> print "The value for $some_string is $map($some_string)\n";
>
> When I run it though I get the following complaint from perl:
>
> A
Hi
The term $map($some_string) actually means 2 scalar variables, one is $map
and the other is $some_string. You get warning of uninitialized variable
because $map is never declared before.
The correct way to refer to a value in hash is $map{$some_string}. I think
there is a typo in the book
Ho
Hi Everyone-
I'm just starting to learn perl programing. I'm doing this through the
O'Reilly book:
Learning Perl.
I seem to be stuck on hashes. I was doing the exercise in the back of
chapter 5. This program wants a hash with 3 keys and 3 values. It then asks
for a string. That string is the