in reply to Iterating over objects

As BUU said, hash keys are only strings; you can't get the reference back out of them. That said, why not use an array of the objects and their argument list?
my @data = ( [ $frame1 => {-text => $hello_string, width => 7} ], [ $frame2 => {-text => $silly_string, width => 9} ], [ $frame3 => {-text => "XXXXX", width => 35} ], [ $frame4 => {-text => $silly_string, width => 7} ], ); for my $set (@data) { my ($frame, $settings) = @$set; $frame->Label( %$settings, # I'm pretty sure you want %$settings -expand => 1, # not just $settings... )->pack();
_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
Re: Re: Iterating over objects
by Fuzzy Frog (Sexton) on May 19, 2004 at 03:10 UTC

    Thank you. I started thinking along these lines when I read BUU's message. Once /s?he/ mentioned it I rembered reading about stringification of hash keys. The problem is that printing a variable that contains a stringified reference yeilds exactly the same thing as printing a variable that contains an actual reference.

    I'm actually leaving tomorrow for a short vacation, so I won't be able to try this out for a few days. I had to bet some feedback on my problem before I left, though. Ohterwise I wouldn't stop thinking about it.

    _______________________________________________________________________
    Two messages found in the same fortune cookie:
    -Friends ask for your time, not your money.
    -Time is money