http://qs321.pair.com?node_id=11119863


in reply to Re^2: Removing a string-element from an array of strings
in thread Removing a string-element from an array of strings

You can also use the stable sort, sorting by whether the string equals the choice. The ones that don't will be sorted as zeroes, i.e. at the beginning of the list, the one that does will be sorted as 1, i.e. will go to the end of the list.
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; use sort 'stable'; use List::UtilsBy qw{ sort_by }; my @history = ( 'Cache::SizeAwareMemoryCache(3)' , 'dhcp-options(5)' , + 'BN_add_word(3)' , 'audit-packages(8)' ); my $choice = 'dhcp-options(5)'; @history = sort_by { $_ eq $choice } @history; say "@history";

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]