Said allan:
>> Keary Suska wrote:
>>
>> IMHO, symbolic refs are syntactic sugar that make code difficult to read,
>> follow, and debug. I recommend using hashes or objects instead. They are
>> easier to read, follow, and debug, and are more extensible.
Not to mention that those extra sigils give Python programmers a reason to
complain about Perl's "ugliness" ;-)
> hi keary,
>
> thanks for the suggestions.
>
> but i dont see how you can use a hash in this case . the
> variable name could be many different names as it is
> concatenated dynamically.
>
> would you happen to have an example of this?
A hash implementation might look like this:
$append = '_name';
$test = "variable$append";
$symbols{$test} = 'a string';
print $symbols{$test};
> my $append = "_name"; # this string could be anything
> my $test = "variable$append";
> $$test = "a string";
> print $variable_name;
Cheers,
David