What does my do? Age: 17
School: Alberta Distance Learning Center
Location: British Columbia, Canada If at first you dont't succeed, try, try again. - programmer's motto.
"Use the keyword 'my' to declare your variables. Using the keyword 'local' creates a variable whose scope includes any called subroutines..."
perl, cgi, and javascript - 2000 Sybex
i understood it like javascript variables inside and outside of functions - declaring the variable inside would be like using 'my', it's value is specific to that function, not all functions
(sorry to quote from a book, but i'm no expert and you helped me earlier...)
Thanks, that makes sense. Age: 17
School: Alberta Distance Learning Center
Location: British Columbia, Canada If at first you dont't succeed, try, try again. - programmer's motto.
sub my_what
{
my $var = 'This var is visible only inside this sub';
print "$var\n";
} If you are new to Tek-Tips, please use descriptive titles, check the FAQs,
and beware the evil typo.
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.