thanks bart, that works, but since i want to build those symbolic references dynamically (the reason for the symbolic refs are because the camel book suggests those in favour of eval on a string) how can i then pre-declare my variables (since i don't know their names before the script runs)? is that possible (under use strict)?
my $append = "_name"; # this string could be anything my $test = "variable$append"; $$test = "a string"; print $variable_name; thanks again ../allan Bart Lateur wrote: > > 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.