pjanzen has asked for the wisdom of the Perl Monks concerning the following question:

Hi all ..

I am struggeling for some now with the follwoing problem. I am doing a query on a oracle DB and get the results via fetchrow_hashref, and that is giving me a long list back which viewed with Dumper. the data i get back is
$VAR = [ 'bla', 'bla1', 'etc', 'etc', ];
now i want to print that to the screen using map, like this

Snippet of code
my $self = shift; my $q = $self->query(); # The execute is called from a differnt module for securety reasons. a +nd there is the actual fetch done. my $result = $self->execute(statement => 'data_ossd', ary2d => '1', handle => 'appframe'); print STDERR Dumper($result); my $output = $q->table({-border=>'1', -align=>'center'}); $output .= $q->Tr({-align=>'CENTER', -valign=>'TOP', -width=>'70 +%'}); $output .= $q->th({-style=>'font-size: 10px'},['Mso_id','Mso_nam +e','Postcode','Housenumber','Appertment number','Who enterd data', 'Email send to','Date send','Update recieved','TT number','Status']); $output .= $q->Tr(map{$q->td($_)}@{$result}); return $output;
at the moment it is all being printed in one long line but i want to print per row in a table.
the script is based on CGI::Application to create a secure env for the user. I hope i have typed a clear question but i doubt it :)
Thnx for any responses
paul janzen

Replies are listed 'Best First'.
Re: 2d array
by sauoq (Abbot) on Aug 01, 2002 at 20:16 UTC
    It looks like you are using fetchrow_arrayref() not fetchrow_hashref() but that was probably a mistake in your question.

    The code you presented will print one row. I assume you have a loop somewhere. I don't think we can help you without seeing how you are iterating through each row you want to print.

    -sauoq
    "My two cents aren't worth a dime.";
    
      Thnx for reading my question :)
      I have some reformatting on my question to do
      On the otherhand i might have better luck with fetchrow_arrayref,
      but as i have not written the module that collect's the data it is better that i speak to the mod writter first

      Thnx again for the help

      Paul Janzen
Re: 2d array
by BrowserUk (Patriarch) on Aug 01, 2002 at 23:46 UTC

    I went through this a while ago:

    print start_table, Tr[ map { td[ $_ ] } @values ], end_table;

    will give you a 1 column table with 1 value per row.