Gossamer Forum
Home : General : Perl Programming :

symbolic reference vs hash refernce

Quote Reply
symbolic reference vs hash refernce
Hi there,

I just read some articles in "Perl Best Practices" (http://perl.find-info.ru/...p-chp-11-sect-3.html) and now I know that many things I do/did are certainly not Best Practices. Most ofthe arguments look logic and clear as soon as you read them. There is one Chapter about "Never use symbolic references". Would be no problem in theory but I do not really get the point. GT - as far as I can see that - use them very much. E.g.

# Get our form data.
my $input = $IN->get_hash;

# This will set system fields like Validated to their proper values.
foreach my $key (keys %{$CFG->{add_system_fields}}) {
$input->{$key} = $CFG->{add_system_fields}->{$key};

It woud be interesting to hear why and why nots.



Last edited by:

el noe: Jun 20, 2010, 4:53 AM
Quote Reply
Re: [el noe] symbolic reference vs hash refernce In reply to
None of the code you pasted uses symbolic references. Those are just plain hash refs.

Take a closer look at their examples of what a symbolic reference is. Notice that they're using a string in a variable to access the variable named by the string.

Quote Reply
Re: [brewt] symbolic reference vs hash refernce In reply to
Hi Adrian,

thank you for your reply. Obviously I have to look closer at the intricacies of Perl. I just started to reread the whole book :)