@$obj{@fields} is the only way I know to get a slice of a hashref, but as with many other perl constructs, I found that it seemed ugly only as long as I was unfamiliar with it.
If you're squeezing for speed efficiency, I think you'd be better off using lexicals: they're normally faster than package variables, because the location of lexicals is determined at compile time, whereas package variables require a run-time hash lookup to find the glob.
HugoIn reply to Re: unpack() into object fields
by hv
in thread unpack() into object fields
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |