I think the general answer you will get is "don't do it that way" for various reasons. It is only ever a good idea if there are absolutely no alternatives, and even then you should always rethink doing it that way.
This code will do exactly the same thing except it uses keys in a hash to give you the ability to dynamically specify the name of the data, and gets rid of the warning. #!/usr/bin/perl -w my $hello='helloworld'; $data{$hello} = 'foo'; print STDOUT $data{helloworld}."\n"; Rob -----Original Message----- From: Alan John Drew [mailto:[EMAIL PROTECTED]] Sent: Monday, June 03, 2002 6:15 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]' Subject: Storing variable names in strings Hi, I have this snippet of code which actually works, but I would like to get rid of the warning.... [PbFe]$ more foobar.pl #!/usr/bin/perl -w #my $helloworld; my $hello='helloworld'; ${$hello}='foo'; print STDOUT $helloworld."\n"; [PbFe]$ ./foobar.pl Name "main::helloworld" used only once: possible typo at ./test.pl line 7. foo [PbFe]$ Kinda neat, dont you think? Even if I dont get an answer, it may help some other poor perl beginner..... As you can see, I tried to define $helloworld to fix this problem, but get the following error when run: Can't declare scalar deref in my at ./foobar.pl line 4, near "}=" Execution of ./foobar.pl aborted due to compilation errors. Any ideas? A. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]