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

Re: Newbie Help please.

Thread Previous | Thread Next
From:
Ahmed Moustafa
Date:
March 31, 2002 05:04
Subject:
Re: Newbie Help please.
Message ID:
3CA70942.3070909@pobox.com
Sa wrote:
> #!/usr/bin/perl -w
> $map{"red"} = "apple";
> $map{"green"} = "grass";
> $map{"blue"} = "ocean";
> print "A string please: "; chomp ($some_string = <STDIN>);
> print "The value for $some_string is $map($some_string)\n";
> 
> When I run it though I get the following complaint from perl:
> 
> A string please: blue
> Use of uninitialized value in concatenation (.) at ./key3.pl line 6, <STDIN>
> line 1.
> The value for blue is (blue)


In line 6, it's $map{$some_string} not $map($some_string).

Regards,
-- 
Ahmed Moustafa
http://pobox.com/~amoustafa


Thread Previous | 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