Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Accessing this array ref.

by Cristoforo (Deacon)
on Apr 03, 2013 at 19:52 UTC ( #1026897=note: print w/replies, xml ) Need Help??


in reply to Re^2: Accessing this array ref.
in thread Accessing this array ref.

I don't understand your question. If the data is sorted as Loops said, his solution should work for you.

Replies are listed 'Best First'.
Re^4: Accessing this array ref.
by Anonymous Monk on Apr 03, 2013 at 20:05 UTC
    I am sorry, is that at the end of processing I have to pass the values as this:
    $template->param('data', $results);
      my $results; my $type; for my $entry (@$VAR1) { if ( $entry->{type} ne $type ) { $type = $entry->{type}; push @$results, "$type\n"; } push @$results, "\t$entry->{name} - $entry->{reference}\n"; }
      Then this should do it.
        That was my post above and it occurred to me that you probably want $results as a string to be printed in a web page. If so, I might suggest something like this.
        my $results = "Results: "; my $type; for my $entry (@$VAR1) { if ( $entry->{type} ne $type ) { $type = $entry->{type}; $results .= "$type<br />"; } $results .= "&nbsp;&nbsp;&nbsp;$entry->{name} - $entry->{refer +ence}<br />"; }

        Update: Now that I've thought about it, it seems you are using HTML::Template or something like it to display your data. And I'm not familiar with that but you probably do want to pass it a structure and not a string.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1026897]
help
Chatterbox?
[erix]: hm nice might do a spot of diving - Red Sea is said to be beautiful
[LanX]: well too many terrorist tourists
[erix]: I guess I can pass for a native
[LanX]: talking about destruction of diving spots
[LanX]: Nodes to consider
[erix]: oops - got to run, see you later
[robby_dobby]: erix: 'appy day'ving

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (12)
As of 2017-04-24 16:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (442 votes). Check out past polls.