$ perl5.10.0 -E '$_="ab cd ef gh";m/(?\S+)\s+\S+\s+(?\S+)/; for(keys %+){say "$_:\t$+{$_}"}; say "\$+: $+";' bar: ef foo: ab $+: ef