Rodster001 has asked for the wisdom of the Perl Monks concerning the following question:
So, I might get burned for asking this, but it has been on my mind and I want to really understand.
I tend to avoid using -w for one reason, it complains about a habit I have. I like to do this:
Is this really *that* bad? If so why? And how would you rewrite the same block? Just omit the my's or use different variable names?my $query = "SELECT something FROM somewhere"; my $sth = $dbh->prepare($query); my $rv = $sth->execute; my $first_result = $sth->fetchrow_hashref; my $query = "SELECT somethingelse FROM somewhereelse"; my $sth = $dbh->prepare($query); my $rv = $sth->execute; my $second_result = $sth->fetchrow_hashref; ... then do something with $first_result and $second_result
Also, if I "reuse" $query, $sth, $rv several times (as in the above example) what is actually happening in memory?
Thanks for your insight and helping me be a better Perl programmer :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Warnings...
by ikegami (Patriarch) on Jan 27, 2009 at 17:23 UTC | |
|
Re: Perl Warnings...
by moritz (Cardinal) on Jan 27, 2009 at 17:23 UTC | |
|
Re: Perl Warnings...
by matija (Priest) on Jan 27, 2009 at 18:49 UTC | |
|
Re: Perl Warnings...
by JadeNB (Chaplain) on Jan 27, 2009 at 22:09 UTC |