my @priority = qw/RB1 RB2 FL1 FL2 QB1 QB2 TE1 WR1 WR2 DST/; my $position = q{QB2}; # Print original list print join q{ }, @priority; # Process using original regex, with spaces @priority = grep {!/ $position / } @priority; print join q{ }, @priority; # Process using regex with spaces removed @priority = grep {!/$position/ } @priority; print join q{ }, @priority;