Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
> but I find this kind of inelegant.
well, how would you do it in other "more elegant languages"? > I'm far far from a monk so bear with me, but I can't see why keys doesn't provide list context. keys HASH operates on the datatype hash not list, which means something starting with a % sigil here > "Experimental keys on scalar is now forbidden" that's another topic which wouldn't have helped you much, but you "probably" would have been able to write keys {f()} Questions are:
HTH! :)
editmy preferred way to gain elegance would be a private method, operating on a reference
edit> Also, is there a way of creating a hash for consumption by keys in the above situation which doesn't involve creating a hash reference from a list and then immediately dereferencing? could you please elaborate? I don't understand the question ...
updatesee also Re^10: Using 'keys' on a list (prototype & backwards compatibility) for a full explanation why your feature request can't possibly be implemented.
Cheers Rolf In reply to Re: Using 'keys' on a list
by LanX
|
|