in reply to Interpolation in variable names

You don't want to use a variable as a variable name. Dominus has said why much better than I can. Most likely, you want to use a hash to store the information about fruits:

my %fruits = { orange => { name => 'Malus', size => 123 }, apple => { name => 'Citrus sinensis', size => 10 }, };

You can then access your data as

my $fruit = 'orange'; print $fruits{ $fruit }->{name}, "\n"; print $fruits{ $fruit }->{size};

Also see tye's References Quick Reference for how to use references.

Replies are listed 'Best First'.
Re^2: Interpolation in variable names
by ddc_nh (Initiate) on Mar 16, 2010 at 14:29 UTC
    Thanks, I did found a work around using a hash instead.

      That's not a workaround, it's the preferred way to implement the behaviour you were initially looking for.

      --
       David Serrano
       (Please treat my english text just like Perl code, i.e. feel free to notify me of any syntax, grammar, style and/or spelling error. Thank you!).