Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Another scoping issue: How do I send 2 variables to my sub and use both.

by starX (Chaplain)
on Feb 05, 2010 at 16:29 UTC ( [id://821600]=note: print w/replies, xml ) Need Help??


in reply to Another scoping issue: How do I send 2 variables to my sub and use both.

Highly untested, but try this:
sub getPlatformFiles { my $plat_in = shift; my $nic = shift; my @list; if ($plat_in =~ /RedHat/) { @list = ("/etc-test/resolv.conf", "/etc-test/sysconfig/network-scripts/ifcfg-$nic->{de +vice}"); } return @list; }
You're passing in a list of two elements, so you need to shift the second one onto a more localized variable in order to access it within the subroutine.
  • Comment on Re: Another scoping issue: How do I send 2 variables to my sub and use both.
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-19 02:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found