>>>>> "OC" == Owen Chavez <owen.chavez314...@gmail.com> writes:
OC> use strict; OC> use warnings; that is good. OC> my $testvar = "TEST"; OC> &testsub1(); that is wrong. don't call subs with & as it isn't needed and can cause a bug if you don't know what you are doing with it. OC> sub testsub1 { OC> print "The following should read \"TEST\": $testvar \n"; don't do \" if you can help it. use other internal markers like [] or '' instead. if you must have " inside a "" string, use an alternate delimiter. OC> } OC> ... while this throws up "Global symbol $testvar" requires OC> explicit package name ..." etc. etc. well it does require being declared BEFORE it is used. OC> sub testsub1 { OC> print "The following should read \"TEST\": $testvar \n"; OC> } you use it above. OC> my $testvar = "TEST"; you declare it below. and this has nothing to do with subs so your subject is misleading. that is ok because you didn't understand the problem. any use of a variable must be preceded by a declaration of that variable in some containing scope. that is what strict requires (among other things). the same problem will show up if you did this without subs. uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/