See vars. The way to make a global variable known to Perl without prefixing its full name is:
use strict; use vars qw($HELLO); $HELLO = 'Hello'; sub new_message { $HELLO = 'Nihao'; };
In reply to Re: Defining global variable in a subroutine
by Corion
in thread Defining global variable in a subroutine
by bihuboliya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |