Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 4. Subroutines > Item 44. Avoid using @_ directly unless you have to

Item 44. Avoid using @_ directly unless you have to

Unlike many programming languages, Perl has no built-in support for named or “formal” parameters. The arguments to a subroutine are always passed in via a single array variable called @_. It is up to the author of the subroutine to give the arguments names and check them for consistency.

In general, you should always start off a subroutine by copying its arguments and giving them names. The preferred method is to use my:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial