But what I'd really like to do is something like:This doesn't seem to work. When I shift the hashref to a scalar in the sub the scalar only knows about the first key id_one. . .get_id({'id_one','id_two','id_three'})
Actually, it knows about two keys in that example: 'id_one' and 'id_three'. The reason is that 'id_two' ends up being the value associated with 'id_one'. A => is really a glorified comma and perl doesn't mind at all if you use a regular comma instead.
The question you've left us with is: why are you doing that? It looks like you should probably just be passing the arguments normally or perhaps using an array ref. The example you've given seems a bit contrived though, so it's hard to see what problem you are really trying to solve.
-sauoq "My two cents aren't worth a dime.";
In reply to Re: Pass anonymous hash - keys only?
by sauoq
in thread Pass anonymous hash - keys only?
by blahblah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |