in reply to adding a plus button to change perl GUI dynamically during press (Perl TK)
The trick is to use a subroutine for the repeated code:
#!/usr/bin/perl use warnings; use strict; use Tk; sub create_entry { my ($parent, $entries) = @_; push @$entries, undef; $parent->Entry(-textvariable => \$entries->[$#$entries]) ->pack; } my $mw = 'Tk::MainWindow'->new(-title => 'Adding entries'); my $frame = $mw->Frame->pack; my @entries; create_entry($frame, \@entries) for 1 .. 4; $mw->Button(-text => '+', -command => [ \&create_entry, $frame, \@entries ])->pack; $mw->Button(-text => 'Done', -command => sub { $mw->DESTROY })->pack; MainLoop(); print "$_\n" for @entries;
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|