use strict; my($a,$b,$c,$d); my $str="a b c d"; if($str=~m/(\S)\s(\S)\s(\S)\s(\S)/) { ($a,$b,$c,$d)=map {eval(\$$_)} (1..4);} print $a,"\n",$b,"\n",$c,"\n",$d;