my @dimensions = qw/ page_path /; my @metrics = qw/ pageviews unique_pageviews avg_time_on_page entrances exits /; . . . (get the data into $res, this works fine) foreach my $r (@{ $res->rows }){ my @line; foreach my $get ( @dimensions, @metrics ){ my $get_method = "get_$get"; push @line, $r->{$get_method}->(); # this is wrong } push @report, join( "\t", @line); }