Hey,
I have a variable on @_ , I need to pull it off, set another variable equal to it and then shove it back onto @_ again. Can anyone help me out? Thanks
Well the @_ only has a scope of the subroutine you are using, so you can't use it anywhere else. Which makes changing the value of it kind of pointless. But I am pretty sure that you can change it. Just set the value of the element from the @_ array to the new value. For example of you want to change the 2nd element it would be $_[1] = "New Value";
ok got that first question figured out...this next one is about scope
is there any way for me to reference a variable local to a subroutine?
For example:
sub {
my $foo;
}
can i reference $foo somewhere else somehow?
thanks
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.