Hi!
Can anyone explain to me how map works in this code?
for my $h (
# grab the Subject and Date from every message in my (fictional!) smut
folder;
# the first argument is a reference to an array listing all messages in
the folder
# (which is what gets returned by the $imap->search("ALL") method when
called in
# scalar context) and the remaining arguments are the fields to parse out
# The key is the message number, which in this case we don't care about:
values %{$imap->parse_headers( scalar($imap->search("ALL")) , "Subject",
"Date")}
) {
# $h is the value of each element in the hash ref returned from
parse_headers,
# and $h is also a reference to a hash.
# We'll only print the first occurance of each field because we don't
expect more
# than one Date: or Subject: line per message.
print map { "$_:\t$h->{$_}[0]\n"} keys %$h ;
}
How can I access this and break it done to look at each line?
Thanks,
Jerry