in reply to Re: Assign result of map to scalar variable
in thread Assign result of map to scalar variable

my $VAL = (grep { defined } map { /^\*\s\(?([^\)]+)\)?/ ? $1 : () } @G +ET_STRING)[0];

The grep seems unneeded: (Update: in the quoted code) nothing from map will ever be undefined:

>perl -wMstrict -le "my @GET_STRING = ('no', '*nine', '*(not)', '* yes', '* (yup)', '* ya)'); ;; my $first = (map { / ^ \* \s \(? ([^\)]+) \)? /x ? $1 : () } @GET_STRING)[0]; print qq{'$first'}; " 'yes'