atnonis has asked for the wisdom of the Perl Monks concerning the following question:
hello monks!
i have a problem parsing a hash into a sub
atnonis!
i have a problem parsing a hash into a sub
i get the following error:new_packages($fcount,%new_db); sub new_packages { my %packages = $_[1]; print "Found $_[0] packages for download: $_\n" if ($fcount > 1); print "Found $_[0] package for download: $_\n" if ($fcount == 1); print "Which one would you like to install?:\n"; foreach my $key (keys (%packages)) { print "$key) $packages{$key} \n" } }
the hash has these values:Odd number of elements in hash assignment at ./slackup.pl line 49. Use of uninitialized value in concatenation (.) or string at ./slackup +.pl line 50. Found 3 packages for download: Which one would you like to install?: Use of uninitialized value in concatenation (.) or string at ./slackup +.pl line 54. 1)
where is my mistake i cant figure out!?%new_db = (1 => 'gedit-2.2.2-i386-1.tgz', 2 => 'ppp-3.4.1-i386-2.tgz')
atnonis!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: parse hash to sub
by Trimbach (Curate) on Jul 15, 2003 at 17:24 UTC | |
Re: parse hash to sub
by jsprat (Curate) on Jul 15, 2003 at 17:25 UTC | |
Re: parse hash to sub
by bunnyman (Hermit) on Jul 15, 2003 at 17:30 UTC | |
Re: parse hash to sub
by BrowserUk (Patriarch) on Jul 15, 2003 at 17:30 UTC | |
Re: parse hash to sub
by blue_cowdawg (Monsignor) on Jul 15, 2003 at 17:35 UTC | |
by hmerrill (Friar) on Jul 15, 2003 at 19:33 UTC |
Back to
Seekers of Perl Wisdom