Reputation: 23
I cannot get perl to read a hash key that was passed to it from param().
this does not work.
append_file('pending_entries.txt',$spanish_url{param('venue')});
nor this,
my $var = $spanish_url{param('venues')};
append_file( 'pending_entries.txt', $var ) ;
nor this
my $ven = param('venue');
my $var = $spanish_url{$ven};
append_file( 'pending_entries.txt', $var ) ;
but this does.
append_file('pending_entries.txt',$spanish_url{'key'});
please help.
Upvotes: 2
Views: 368
Reputation: 67910
Have you tried printing the value in the param to see what it is? Hash keys must be exact. Probably you have something like key\n
or Key
in your param. The Data::Dumper
module (core module in perl 5) is very good for such debugging. E.g.:
use Data::Dumper;
$Data::Dumper::Useqq = 1;
print Dumper param('venue');
Upvotes: 2