#!/usr/bin/perl -- use strict; use warnings; use Tk; my $mw = tkinit(); my $l = $mw->Label->pack( -side => 'bottom' ); $mw->Button( -command => [ \&ralala, $l ], )->pack; MainLoop(); sub ralala { my( $l ) = @_; $l->configure( -text => join "\n", 1 .. rand 4 ); }