in reply to trying to use loops in perl gtk2

You only create one $label outside of the loop. If you want to create five labels, you need to put the label creation into the loop:

... my $vbox1=Gtk2::VBox->new; for my $num (1 .. 5){ my $label=Gtk2::Label->new("Total Count: $num"); $vbox1->add($label); } $window->add($vbox1);

Replies are listed 'Best First'.
Re^2: trying to use loops in perl gtk2
by Muskovitz (Scribe) on Jan 05, 2015 at 22:17 UTC
    thanks `Corion` thats what i need, very thanks! but i think
    my $num=0;
    is just a waste code! btw thanks again!