I'm using Class::DBI. I have the following syntax which won't work (in Perl 5.005) and I'm wondering how it can be done:
use strict; use warnings; ...snip... my $nn = "admin_contact_fk" ; my $foo = $record->$nn; perl -c CDNR.pm syntax error at CDNR.pm line 293, near "$nn;" BEGIN not safe after errors--compilation aborted at CDNR.pm line 466.
Doesn't work... but...
my $foo = $record->admin_contact_fk;
Does work.
Can someone explain how to use a variable with the "->" operator?
UPDATE: changed subject to include perl version
Please don't tell me to upgrade, as I don't control the production environment at my $firm.
-------------------------------------
Nothing is too wonderful to be true
-- Michael Faraday
In reply to Syntax question (Perl 5.005)... by freddo411
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |