freddo411 has asked for the wisdom of the Perl Monks concerning the following question:
I'm stuck on a syntax problem. I'm using Class::DBI which lets me get at values of fields within a DB by treating each row as an object. So normally I'd refer to my "id" as:
OK so far, but now I need to be more dynamic, like so:print $rowobj->id;
but this gives me an syntax error when I perl -c my code.my $columnname = 'id'; print $rowobj->$columnname;
How do I use a variable value in this case?
-------------------------------------
Nothing is too wonderful to be true
-- Michael Faraday
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Syntax question when using Class::DBI
by fglock (Vicar) on Dec 09, 2004 at 01:47 UTC | |
by Your Mother (Archbishop) on Dec 09, 2004 at 03:17 UTC | |
by fglock (Vicar) on Dec 14, 2004 at 21:10 UTC | |
|
Re: Syntax question when using Class::DBI
by broquaint (Abbot) on Dec 09, 2004 at 01:13 UTC | |
|
Re: Syntax question when using Class::DBI
by perrin (Chancellor) on Dec 09, 2004 at 01:26 UTC | |
|
Re: Syntax question when using Class::DBI
by Fletch (Bishop) on Dec 09, 2004 at 00:58 UTC | |
by freddo411 (Chaplain) on Dec 09, 2004 at 01:28 UTC | |
by Corion (Patriarch) on Dec 09, 2004 at 08:18 UTC |