ergowolf has asked for the wisdom of the Perl Monks concerning the following question:
I would prefer to use the foreach loop like this...for (; $first <= $last; $first++) { print $c->article($first); }
My problem is that some message IDs don't exist and have no array pointer causing problems in my program. I thought I could get rid of the errors this way...($first, $last) = ($newserver->group($newsgroup)); my @messages = ($first..$last); foreach (@messages) { print $c->article($_); }
Unfortunately, it doesn't capture the errors. It looks like $c->article($_) points to an array reference. How can I find the message IDs that are causing the problems?($first, $last) = ($newserver->group($newsgroup)); my @messages = ($first..$last); my $count = 0; foreach (@messages) { if ($_ = undef || "") { splice(@testlist, $count, 1); } $count++; } foreach (@messages) { print $c->article($_); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Usenet and arrays
by merlyn (Sage) on Mar 25, 2003 at 14:35 UTC | |
by ergowolf (Monk) on Mar 25, 2003 at 17:20 UTC | |
by merlyn (Sage) on Mar 25, 2003 at 17:23 UTC | |
|
Re: Usenet and arrays
by davorg (Chancellor) on Mar 25, 2003 at 14:26 UTC | |
|
Re: Usenet and arrays
by dakkar (Hermit) on Mar 25, 2003 at 14:31 UTC | |
|
Re: Usenet and arrays
by iguanodon (Priest) on Mar 25, 2003 at 14:43 UTC |