my $msg = $pop->get($msgnum); pop @{$msg} if $msg->[-1] =~ /^\s+$/; # This is the additional line. print MAILBOX @$msg;