my %exists = map {$_ => 1} qw(U F S); say for grep {$exists{$_}} qw(R A F U S W);