Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^2: perl/gtk2 simplelist

by hinkle (Initiate)
on Dec 06, 2004 at 21:08 UTC ( #412756=note: print w/replies, xml ) Need Help??

in reply to Re: perl/gtk2 simplelist
in thread perl/gtk2 simplelist

I've used the @{$slist->{data}} command before. My problem is finding ways to get all the info out of it in something that I can parse. Are you breaking this up in any way? I've tried simple things like foreach $line (@{$slist->{data}}) { } to see if i could parse it like a normal array but that's a no go.

Replies are listed 'Best First'.
Re^3: perl/gtk2 simplelist
by The Mad Hatter (Priest) on Dec 06, 2004 at 21:19 UTC

    (Minor nit: it's not a command. It's accessing an array reference. Read up on Perl data structures.)

    $slist->{data} is an array reference of other array references (the "rows" in the list) each item of which is a piece of data (the "columns" in each row). Fiddle about with this:

    for my $row (@{$slist->{data}}) { print "Row:\n"; for my $col (@{$row}) { print " $col\n"; } }
    or use Data::Dumper to visualize the data structure in a more Perlish way:
    use Data::Dumper; print Dumper($slist->{data}), "\n";

    (Untested code.)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://412756]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2018-07-21 19:45 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (450 votes). Check out past polls.