my $str = 'hello world'; $str =~ /^(\S+)\s/; print $1; #### my $str = 'hello world'; my ($match) = $str =~ /^(\S+)\s/; print $match;