foreach my $part (@parts) { next unless defined $part->head; my $type = $part->effective_type; my $filename = $part->head->recommended_filename || ""; if ($type =~ m!application/applefile!i) { # print STDERR "skipping: $type $filename\n"; next; } my @thispart = ($part->head->as_string, $part->bodyhandle->as_string); if ($type =~ /^image/i || ($type =~ /application|octet/i && $filename =~ /\.gif$/i)) { push @images, \@thispart; } elsif ($type =~ /^text/i) { push @text, \@thispart; } }