$authentication = join " ", $str =~ /authentication ?(\S+)?/g; #even more perlish