$desc =~ /.+\[(.+)\]\s*$ (?{ $org = $1 or ''; })/x; #### my $enz, my $org; my $rx_enz_org = qr/ (.+)\[(.+)\]\s*$ (?{ $enx = $1 or ''; $org = $2 or ''; }) /x; $desc =~ /$rx_enz_org/;