Re: [Boston.pm] something about @_ is different?

Uri Guttman <uri-X/[email protected]> Tue, 21 May 2019 15:46:28 -0400
Newsgroups gmane.comp.lang.perl.perl-mongers.boston
Organization Perl Hunter
Message-ID <[email protected]>
On 5/21/19 3:42 PM, Bill Ricker via Boston-pm wrote:
> On Tue, May 21, 2019, 2:12 PM Conor Walsh <[email protected]> wrote:
>
>> Assigning to @_ is weird and I don't recommend it. It's full of magic
>> aliases, which in some cases means you change the caller's variables, which
>> is usually not what you want.
>>
>> Check the beginning of perldoc perlsub.
>>
> Agreed.
>

here is one useful case for modifying @_, when you are about to do a 
magic goto call. i have assigned a fresh set of values to @_ like this:

             @_ = ( $opts, "read_file '$file_name' - sysopen: $!");
             goto &_error ;

you can shift off, push onto or splice @_ but know that its values are 
aliased to the subs arguments.

uri

_______________________________________________
Boston-pm mailing list
[email protected]
https://mail.pm.org/mailman/listinfo/boston-pm