#!/usr/bin/env perl use 5.010; use strict; use warnings; { local $/ = "\n>"; while () { chomp; my ($top, $seq) = split /\n/, $_, 2; print '>' unless $. == 1; say $top; $seq =~ y/\n//d; say $seq; } }