Help for this page
perl -pe 'chomp if s/^START//..s/^END//; s/\S\K$/ /' input.txt
use warnings; use strict; ... : [$_,0,$_] } @lines; print join(" ", @lines), "\n"; }