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

push and for loops help

Brian Johnson
March 19, 2002 08:09
push and for loops help
Message ID:
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

Should I just parse the mbox file again? Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About