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


in reply to Re: simple regex problem
in thread simple regex problem

I like this approach (its the only one listed that fits the "only two" spec) but what happens if there is only one space?
"this    hasonlyonespace" => "this hasonlyonespace"

How about:

$line =~ s/\s+/ /g; $line =~ s/ /:/ for (1,2);

-Blake