Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Passing $2 to a sub

by baku (Scribe)
on Feb 13, 2001 at 23:03 UTC ( #58194=note: print w/ replies, xml ) Need Help??


in reply to Passing $2 to a sub

You can't use $_ in stead of @_ like that. You want to change the subroutine to one of:

sub createTable { my $value = shift; print $value; } # or sub createTable { print $_[0]; # subscript means array }

The $x syntax only works for @x variables when followed by a subscript in []'s. See perlvars for LOTS of details :-)


Comment on Re: Passing $2 to a sub
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://58194]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2015-07-03 16:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (54 votes), past polls