sub addfor{ my ($mainwidget,$entryVariable) = @_; my $ex = 0; if (grep(/^$entryVariable$/,@history)) { $mainwidget->messageBox('-icon' => 'error', -type => 'OK', -title => 'Error for input',-message=>"duplicate input"); $ex= 1; } unless ($ex){ $widget{'forwardlistbox'}->insert('end', $entryVariable); push (@history, $entryVariable); } }