in reply to Using Mail::IMAPClient

If you want to get the combined results of searches for three different subjects, you can run each search individually and build one big list to loop over. Your code might look like this:

my @results1 = values %{imap->... 'SUBJECT', 'Subj1' ...}; my @results2 = values %{imap->... 'SUBJECT', 'Subj2' ...}; my @results3 = values %{imap->... 'SUBJECT', 'Subj3' ...}; my @all_results = (@results1, @results2, @results3); for my $h (@all_results){ # Your code manipulating $h as before... }
There are much cleaner ways to do this (using map with a list of subjects), but hopefully this makes it clearer what is going on.

In general, if you want to know the size of an array, you use the array in scalar context. That is to say:

# sets $num_results to size of @all_results array. my $num_results = @all_results;
... which would give you the total number of results your search returned. I'm not sure if this is enough in your case though, as you might need to loop over your results to identify only those dated in the last X minutes.

Hope this gets you started!

Replies are listed 'Best First'.
Re^2: Using Mail::IMAPClient
by jpavleck (Initiate) on Nov 08, 2005 at 22:27 UTC
    Thank you very much, that helps me a lot. I just have a couple of questions - if the search doesn't return anything, the script dies with a undefined hash error - I don't know how to handle that one. Also, do you know of some good beginner links where I can learn more about hashes, map, scalar, and other related items? I've googled, but I may just not be getting the terms right as I'm not getting anything that really lays it out there. Well, back to the net and these ORA books :D - thanks again!