$main->repeat(50 => \&run) MainLoop; sub run { $clip->WaitForChange(); # needs to NOT block. my $contents = $clip->Get(); if ($mode) { $clip->Set(uc($contents)); } }