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