Re: [MacPerl-AnyPerl] symbolic references <-> no strict refs

[email protected] (Bart Lateur) Sun, 17 Mar 2002 12:38:22 +0100
Newsgroups perl.macperl.anyperl
Organization MediaMind
Message-ID <[email protected]>
On Sun, 17 Mar 2002 17:36:03 +0800, allan wrote:

>can someone please explain why the below script doesn't work
>on  v5.6.0/mac osX?
>it _will_ work if i outcomment "use strict";

>#!perl
>use strict;
>no strict 'refs';
>my $test = "variable_name";
>$$test = "a string";
>print $variable_name;

"no strict 'refs'" allows symbolic references to work. So the syntax
check fails over the fact that '$variable_name' is not a declared
variable.

Insert

	use vars '$variable_name';

or

	our $variable_name;

to get past that hurdle.	

-- 
	Bart.