sub addfor{ my ($mainwidget,$entryVariable) = @_; my $ex='false'; foreach (@history) { if ($_ eq $entryVariable ) { $mainwidget->messageBox('-icon' => 'error', -type => 'OK', -title => 'Error for input',-message=>"duplicate input"); $ex= 'true'; } } if ($ex eq 'false'){ $widget{'forwardlistbox'}->insert('end', $entryVariable); push (@history, $entryVariable); } }