in reply to Re: Our, use vars, and magic, oh my!
in thread Our, use vars, and magic, oh my!
our variables can be seen in subroutines and my variables declared at the top of your script cannot be seen inside your subroutines.This is only true if you put your subroutines above the top of the script, i.e. above the my declarations.
Some code - where $var can be accessed in the subroutine:
use strict; my $var = 4; sub foo { $var = 'bar'; } foo; print $var;
-- Hofmator
|
|---|