develooper Front page | perl.perl5.porters | Postings from June 2014

Re: [perl #122162] Warning on <at> _ outside subroutine

Thread Next
Ed Avis
June 24, 2014 06:38
Re: [perl #122162] Warning on <at> _ outside subroutine
Message ID:
Brian Fraser <fraserbn <at>> writes:

>Nothing wrong with using  <at> _ outside of a subroutine. And beyond being
>a possible shortcut, it has its own use:
>sub foo { @_ }
>@_ = "val";
>say &foo

This is a highly wizardly shortcut and only in very marginal cases is it
better than just foo("val").  The documentation does say

    This is an efficiency mechanism that new users may wish to avoid.

That is outweighed for me by the number of types I have typed @_ instead of
@$_ by mistake.  But perhaps it's just me who does that?

Ed Avis <>

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About