in reply to Re^2: Why a reference, not a hash/array?
in thread Why a reference, not a hash/array?

Essentially, you're worried about details you don't need to worry about. At a guess, when you do an "execute", the information isn't loaded into perl's memory yet, but rather will (usually) be sitting in a buffer inside the database itself. Once you do a "fetchall" of some sort, then the entire result set is definitely loaded into perl's memory, and for efficiency's sake what you want is to get a reference to that datastructure, you don't want to make a second copy of it just to save you from thinking about references.

You understand, that when you do a:

$working_href = $returned_href;
that's just making a copy of a scalar value, but if you do a:
%working = %returned;
that makes a copy of the entire data-structure. That doubles you memory usage, and wastes time in making the copy... so you don't want to do that unless you have a really good reason (like you're planning on modifying the copy and you need to preserve the original).

By the way, if you need to join an array given a reference to it, you just do this:

my $string = join " ", @{ $aref };
There's no "extra step" you need to do.