A freelance software engineer with experience in webapplications, databases and bioinformatics.
A contributor to Parrot and the person behind Pipp.
A physicist who worked with third sound in Helium-III and CCD X-ray detectors.
barney on irc.perl.org
github: http://github.com/bschmalhofer [github.com]
LinkedIn:http://www.linkedin.com/in/bernhardschmalhofer [linkedin.com]
XING: https://www.xing.com/profile/Bernhard_Schmalhofer [xing.com]
my $sth = $dbh->prepare(<<'END_SQL');
SELECT color, food, num_legs
FROM pet
END_SQL
my ( $food, $something_else, $color, $num_legs);
$sth->bind_columns( \$color, \$food, $num_legs );
Not being entirely happy with I went one step further and got:
my $sth = $dbh->prepare(<<'END_SQL');
SELECT color, food, num_legs
FROM pet
END_SQL
$sth->bind_columns( \( my ( $color, $food, $num_legs) ) ):
my ( $something_else );
This style enforces some structure in the declaration. Is there a way to make this really nice? Installing a module is no option in this context.
Binding to a hash (Score:1)
Also, in your code, you don't need the parens around "my(...)", though if you like them you can keep them :-)