in reply to Parsing a string from a file

Strict doesn't allow it because it is a very bad idea. ...a design flaw in your code. What you are trying to do is use symbolic references. What you should be doing is using a hashtable (a hash). Why? What happens when one of the messages contains a variable name that is already used in your script for something else? You'll have a bug that is very difficult to trace.

You want something like this:

foreach my $message ( @messages ) { print "$hash{$message}<br />\n"; }

And that means you'll need to redesign so as to use a hash instead of symbolic references as your message container.

Just because symbolic refs are possible in Perl doesn't mean you should be using them.


Dave