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

newbie1991 has asked for the wisdom of the Perl Monks concerning the following question:

Here is what my current array looks like :

(blank) (blank) abcd efgh (blank) (blank) jklm nopq (blank) (blank)

My objective is to a) Delete the double blank spaces. b) All elements between a set of double blanks should be combined together into one element. I was using a foreach loop to check for blank elements but that's a problem when testing for consecutive blanks. Is there a more concise way? The sample output should be:

abcdefgh jklmnopq