in reply to Re: Large data processing ...
in thread Large data processing ...

This is because the @_ array is aliased to the parameters passed.

Its worth explaining aliasing a little better I think: I like to think of it as a reference that doesn't need dereferencing. Which is essentially how its implemented as well. :-)

while you lose out on readability.

Well, you could use for:

sub get_exon { my $end=pop; my $begin=pop; # alias $_[0] to $chromosome to avoid copy semantics speed penalty for my $chromosome (@_) { return substr($chromosome, $begin - 1, $end - $begin + 1); } } # or perhaps sub get_exon { my ($begin,$end)=@_[1,2]; # alias $_[0] to $chromosome to avoid copy semantics speed penalty for my $chromosome (@_) { return substr($chromosome, $begin - 1, $end - $begin + 1); } }

But of course its not as efficient as the straight forward access to @_, but it is worth remembering that for (LIST) aliases the iterator var to the values being iterated over. As such this might be a nice middle ground between super-optimised and unreadable, and optimised and relatively readable.

:-)


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi