Plan B: If you want the advantages of variables and the advantages of hashes, there is a way, but it will cost you a little in speed. There is one language construct that can see variables and can be built with strings, even with strict enabled: eval.{ no strict 'refs'; $sth->bind_columns( map { \${"c_$_"} @{ $sth->{NAMES_lc} } ) }
However, now you're actually letting column names into the Perl parser! A saying about frying pans and fires comes to mind.... I'd much rather disable strict than make wide use of eval STRING.local $, = ',$'; # saves on the joins eval "\$sth->bind_columns(\\( \$@{$sth->{NAMES_lc}} ))"
As for pseudohashes: I think they're great. The only thing about their implementation in Perl 5 that ate me alive was the fact that they weren't a distinct data type, but rather a mere access method, usable with any array at any time. If they had to be declared somehow at their creation, hey, I'd have been praising them in my Topaz talk.
-- Chip Salzenberg, Free-Floating Agent of Chaos
In reply to RE: RE: You can't get there from here....
by chip
in thread References of Eternal Peril
by mwp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |