open(FILE,"f1") or die $!; while(){if($_!~/^\s+/){push(@array1,'>>'.$_);}else{push(@array1,$_);}} $array=join('',@array1); $array=~s/\s+//g; $array=~s/>>/\n/g; print $array;