문제

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.

도움이 되었습니까?

해결책

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');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top