http://www.perlmonks.org?node_id=994576


in reply to Substituting white spaces with a tab changes my string into numeric value

change

$line = s/\s+/\t/g;
to
$line =~ s/\s+/\t/g;