I was under the impession that when I use the keyword "our" when
declaring a variable, that the variable was then available to
subroutines called from the routine that declared the variable.

However, the code shown below fails with the following message:
 
Variable "$clr" is not imported at test5.pl line 17.
Global symbol "$clr" requires explicit package name at test5.pl line 17.

What gives?

-Barry Brevik

===================================
use strict;
use warnings;

my $color = 'blue';

setColor($color);


sub setColor
{
  our $clr = $_[0];
  adjustColor();
}

sub adjustColor
{
  print "$clr\n";
}


_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to