Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: DBI select ids to @ids

by mifflin (Curate)
on Aug 10, 2005 at 06:17 UTC ( [id://482527]=note: print w/replies, xml ) Need Help??


in reply to Re^2: DBI select ids to @ids
in thread DBI select ids to @ids

Why no selectcol_array?
I'm not sure. You could always email Tim Bunce and ask him.
However, dereferencing an array reference is easy. I really don't see a need for it.
Personally, I wouldn't dereference it into an array. You're not showing how your are using the @ids array but if you need to pass it around in your code, say as a parameter to another sub, you will probably want it as a reference anyway.

Replies are listed 'Best First'.
Re^4: DBI select ids to @ids
by tomazos (Deacon) on Aug 10, 2005 at 07:25 UTC
    I agree that wrapping the whole call in @{} isn't hard, however amongst a large chunk of code its easy to mentally parse the brackets incorrectly, or confuse them with end of block delimiters.

    I don't like passing things by reference unless either (A) the sub is going to modify it, or (B) it is so big that it is an efficiency concern. This is because the subroutine might modify it accidentally. Passing by value helps to isolate a bug to a smaller scope (or if the accidental modification doesn't effect the functionality of the sub - avoids it completely).

    Plus its hard to keep track of what is a reference and what isn't, so I try to keep everything lexical and dereferenced to take advantage of the cleaner syntax.

    -Andrew


    Andrew Tomazos  |  andrew@tomazos.com  |  www.tomazos.com

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://482527]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-04-20 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found