kiat has asked for the wisdom of the Perl Monks concerning the following question:
When I enable 'strict', the code doesn't work. I tried to declare the hash %country with 'my' but it doesn't help. I figured it's something to do with Exporter but I'm not quite sure how that's done.#script.pl #!/usr/local/bin/perl #use strict; use CGI qw(:standard); eval { ($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); require 5.001; require "module.pm"; }; if ($@) { die("Error including libraries: $@\n"); } msg(); sub msg { print "Content-type: text/html\n\n"; print "<html>\n"; print "<head>\n"; print "<title>Country</title>\n"; print "</head>\n"; print "<body bgcolor=\"#FFFFFF\" text=\"#000000\">"; print "$country{'af'}<br>\n"; print "</body>\n</html>\n"; } # module.pm # module.pm %country = ( af => 'afghanistan', ao => 'angola', ar => 'argentina', at => 'austria', au => 'australia', bd => 'bangladesh', be => 'belgium', bg => 'bulgaria', );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: Problems with using strict
by jeffa (Bishop) on Apr 19, 2003 at 14:36 UTC | |
by kiat (Vicar) on Apr 19, 2003 at 14:41 UTC | |
by jeffa (Bishop) on Apr 19, 2003 at 14:47 UTC | |
by pfaut (Priest) on Apr 19, 2003 at 14:44 UTC | |
by halley (Prior) on Apr 20, 2003 at 13:01 UTC | |
|
Re: Problems with using strict
by pfaut (Priest) on Apr 19, 2003 at 14:31 UTC | |
|
Re: Problems with using strict
by Aristotle (Chancellor) on Apr 19, 2003 at 15:21 UTC | |
|
Re: Problems with using strict
by pfaut (Priest) on Apr 19, 2003 at 15:23 UTC |