IT Questions and Answers :)

Thursday, November 23, 2017

In Perl, which variable contains the parameters passed to a subroutine?

In Perl, which variable contains the parameters passed to a subroutine?

  • $ARGV
  • $0 through $9
  • @_
  • @parameters 

 
In Perl, which variable contains the parameters passed to a subroutine?

EXPLANATION

The @_ array contains the parameters passed to any perl subroutine, method or function. You may reference the @_ array with either list assignment, e.g. "my ($param1, $param2) = @_;" or via referencing any of the array indicies, e.g. "my $param2 =  $_[1];".

SOURCE

https://stackoverflow.com/questions/4563485/what-is-the-meaning-of-in-perl
Share:

Popular Posts

Blog Archive