in reply to Defining global variable in a subroutine
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'; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Defining global variable in a subroutine
by ikegami (Patriarch) on Feb 22, 2012 at 16:05 UTC |