sub addfor{ my ($mainwidget,$entryVariable) = @_; unless (grep { $_ eq $entryVariable } @history) { $widget{'forwardlistbox'}->insert(end => $entryVariable); push @history, $entryVariable; } } #### use List::Util 'first'; sub addfor{ my ($mainwidget,$entryVariable) = @_; unless (first { $_ eq $entryVariable } @history) { $widget{'forwardlistbox'}->insert(end => $entryVariable); push @history, $entryVariable; } }