tekniko has asked for the wisdom of the Perl Monks concerning the following question:
and languages.txt:#!/usr/bin/perl open(LANGUAGES,"languages.txt") || die "cannot open cities"; %lang_dev = <LANGUAGES>; $hard_reference = \%lang_dev; # \ creates reference to %lang_dev print "Enter a programming language: "; chomp($lang = <STDIN>); print "\n"; print "$lang was originally developed by $$hard_reference{$lang}.\n"; # "$" to dereference hash so value can be accessed sleep (3);
Perl, Larry Wall Java, James Gosling C, Dennis Ritchie C++, Bjarne Stroustrup
produces (when entering Perl):
Perl was originally developed by .
Any insite? Thanks!
Originally posted as a Categorized Question.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: The following returns no value for $lang
by Fastolfe (Vicar) on Oct 26, 2000 at 22:28 UTC | |
|
Re: The following returns no value for $lang
by kilinrax (Deacon) on Oct 26, 2000 at 22:35 UTC | |
|
Re: The following returns no value for $lang
by tedv (Pilgrim) on Oct 27, 2000 at 02:10 UTC |