Is params a ref to a hash or hash who's values are refs to scalars? If the
former, then something is a little weird and you can ignore the rest of
this, if the latter, try
perl -e '$params={moo => "baa"};print $$params{"moo"}."\n"'
vs
perl -e '%params=(moo => "baa");print $$params{"moo"}."\n"'
vs
perl -e '%params=(moo => \"baa");print $$params{"moo"}."\n"'
the first gives 'baa' whereas the second and third give blankness. I think
it's because dereferencing has a higher precedence than hash lookup (check
the man page to find out for sure). So perl evaluates $$params first then
looks up the key moo in the resulting hash. You want
perl -e '%params=(moo => \"baa");print ${$params{"moo"}}."\n"'
to look up moo then dereference the resulting scalar. Sticking a
use strict;
at the top of your code will stop this sort of thing happening,
Fergal
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!