Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Answer: Why does my subroutine not receive the scalar parameter as $_?

by BrowserUk (Pope)
on Aug 25, 2002 at 22:32 UTC ( #192723=categorized answer: print w/replies, xml ) Need Help??

Q&A > subroutines > Why does my subroutine not receive the scalar parameter as $_? - Answer contributed by BrowserUk

Use $_[0] (the first element of @_) instead of $_.

See perlman:perlsub Description for explanation.

  • Comment on Answer: Why does my subroutine not receive the scalar parameter as $_?
  • Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2017-05-23 00:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?