use Regexp::Common; ... my $num = $RE{num}{real}; my ($x, $y, $z) = ($1, $2, $3) if $line =~ /($num) ($num) ($num)\s*$/;