Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

perl/gtk2 simplelist

by hinkle (Initiate)
on Dec 06, 2004 at 20:46 UTC ( #412751=perlquestion: print w/replies, xml ) Need Help??
hinkle has asked for the wisdom of the Perl Monks concerning the following question:

I'm still new to the perl/gtk2 bindings and have had a lot of trouble finding good information on some things. Right now I'm working with perl/gtk2 simplelist and have no problems creating the list, or pulling the selected line from it. What i'm having problems with is figuring out how to grab all entries in the list (into an array maybe?). Has anyone worked with simplelist and would know how to call all entries in the list? I'm not worried if the output isn't very tidy, I just need to find a way to grab all info out of the list.

Replies are listed 'Best First'.
Re: perl/gtk2 simplelist
by The Mad Hatter (Priest) on Dec 06, 2004 at 20:57 UTC
    @{$slist->{data}}
    There might be other, cleaner ways, but that's what I found when I dug around in some older code of mine.
      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: perlquestion [id://412751]
Approved by Old_Gray_Bear
help
Chatterbox?
[thao4]: posted with the title :Replace a patern_2 in 30 lines from the line with the patern_1 founded
[Eily]: karlgoethebier but we're trying to stay hidden!
[shmem]: thao4 example of the text and program missing in your post
[Eily]: also you can use <p> or <br /> tags to have multiple lines
[hippo]: Please also take a moment to read through I know what I mean. Why don't you? - this guidance will help others to help you.

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2018-02-21 10:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (277 votes). Check out past polls.

    Notices?