Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: perl/gtk2 simplelist

by The Mad Hatter (Priest)
on Dec 06, 2004 at 20:57 UTC ( #412755=note: print w/replies, xml ) Need Help??


in reply to perl/gtk2 simplelist

@{$slist->{data}}
There might be other, cleaner ways, but that's what I found when I dug around in some older code of mine.

Replies are listed 'Best First'.
Re^2: perl/gtk2 simplelist
by hinkle (Initiate) on Dec 06, 2004 at 21:08 UTC
    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.

      (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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://412755]
help
Chatterbox?
[ambrus]: Today I accidentally cut my hand while carrying a computer. On the display part of the motherboard that sticks out at the back of the chasis and has ports, there's this thin metal sheet with holes cut for the ports, to guide plugs into the sockets.
[ambrus]: This sheet has sharp needle-like parts, 0.004 long and less than 0.001 wide, that can get bent to point outwards, and one of these cut into my palm when I lifted the box.
[ambrus]: So now when I choose what motherboard to buy for my new home computer, I have one more specific property to guide me. Useful, because there's so many different boards to choose from.

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2017-01-16 19:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (151 votes). Check out past polls.