Question

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.

Was it helpful?

Solution

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');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top