naturalsciences has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I have done some mistakes in concatenating some of my files. There are lines where line endings should have been replaced with space. Now I have a large file where there are lines like these.
37 35 37 8 17 16 25 36 37 3840 42 42 42 40I would be interested in splitting all four number combinations with a space so the entire file would be doubles delimited by spaces.
Seemed easy at the firs look but I got a bit stumped. The idea was read in by lines then
$line =~ s/(/d/d/d/d)/replacement/gNow I always messed up the replacement part I think - it should be along the lines (pseudo) substr $1,0,1 /s substr $1,2,3 but how the hell to stick it into there syntactically correct I couldn't figure out. Or is it not place for such a thing to stick on one line? Anybody here to help me figure this out.
|
|---|