Perl: subroutine parameter parsing: @ARG vs Underscore: @_

Viewed 170

When it comes to naming and parsing the parameters in a perl subroutine, is there any difference between the

@ARG and @_?

2 Answers

You can increase memory consumption and slowdown regular expressions in old interpreters with implicitly exported use English; versions of match variables ($`,$',$&).

This thread will be useful.

And read more about matchvars pitfalls at:

perldoc English

perldoc perlvar

perldoc perlre

I don't know about other issues.

Short answer, no. See perlvar

  • @ARG
  • @_

Within a subroutine the array @_ contains the parameters passed to that subroutine. Inside a subroutine, @_ is the default array for the array operators pop and shift.

Related