develooper Front page | perl.beginners | Postings from March 2002

push and for loops help

From:
Brian Johnson
Date:
March 19, 2002 08:09
Subject:
push and for loops help
Message ID:
000401c1cf60$bbb07bc0$3200a8c0@jecinc.on.ca
I have a section of code that uses Mail::Internet to parse a mbox file -
this part works

Later in the code, I need to cycle through the mbox file again, and I
thought that I could store it in memory instead of re-reading the file

I was trying to use
push @items, $item;

and then use a for loop (in the same procedure)

my $item2;

    foreach $item2 (@items) {
       ....
    }


but it deems to just keep pulling the last item added to the @items array
instead of cycling through them - any help?



As an aside, am I just asking for problems when I try to do this (ie a mbox
file could easily be larger than the system memory if I start dealing with
attachments)

Should I just parse the mbox file again?





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About