Hi All,
Can variables be used in place of column names when looping through DBIx::Class array of objects.
For example:
my @db_colnames = ('lastname','firstname','middlename');
my @rows = $schema->resultset( 'myTable' )->search({},
{order_by => [qw
+/ lastname firstname middlename /] }
);
foreach my $row (@rows) {
foreach my $col (@db_colnames) {
print $row->$col ."\t";
}
print "\n";
}
No value printed. However, when I used the actual column name to retrieve the data, it worked fine.
For example:
.
.
print $row->lastname . "\t" . $row->firstname . "\t" . $row->middlenam
+e . "\t";
print "\n";
.
.
Thanks for your help.