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

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

Thread Next
From:
Ed Avis
Date:
June 24, 2014 06:38
Subject:
Re: [perl #122162] Warning on <at> _ outside subroutine
Message ID:
loom.20140624T083446-592@post.gmane.org
Brian Fraser <fraserbn <at> gmail.com> 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 <eda@waniasset.com>


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About