Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

( #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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2016-07-27 06:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (242 votes). Check out past polls.