my $msg = $pop->get($msgnum); LOOP: for ( 0 .. $#{$msg} ) { unless( $msg->[$_] =~ m/\QContent-Transfer-Encoding: 7bit\E/i ) { print OUTFILE $msg->[$_]; next LOOP; } splice( @{$msg}, $_ + 1, 1 ) if $msg->[ $_ + 1 ] =~ m/^\s+$/; # delete # This is probably a mistake. Delete what? And where's the semicolon? last LOOP; }