in reply to Slicing a reference?
It's not verboten, but it can get ugly. :-)
What you're looking for is @$_[0..3] which does a slice of $_ after you dereference it.
On a different note, have you given any thought to explicitly naming the columns you want to return rather than using SELECT *?
If your schema ever changes, @$_[0..3] might not contain what you think it should, but if you did something like this ...
my $rows = $dbh->selectall_arrayref(" SELECT foo, bar, baz, quux FROM search_atoms WHERE occurences >= 5 ORDER BY occurences DESC "); foreach ( @$rows ) { print Tr( td( {'-align' => 'left'}, $_ ) ); }
... each row would only contain what you need and expect, along with the pleasant side effect of not needing to slice up a reference.
--k.
|
|---|