in reply to concatenating elements of an array in twos

#!/usr/bin/perl # http://perlmonks.org/?node_id=1169870 use strict; use warnings; $_ = <<END; sid 1|FLPSDFFPS LLWFHISCL sid 1|WIRTPPAYR YVNVNMGLK sid 2|FLPSDFFPS LLWFHISCL sid 2|FLPSDFFPS ELMNLATWV sid 7|FLPSDFFPS ATVELLSFL sid 7|VWIRTPPAY LLSFLPSDF sid 9|VWIRTPPAY LLDTASALY sid 9|FGRETVLEY PSDFFPSVR END s/^(sid\s+\d+\|).*\K\n\1/ /gm; print;