RE: MySQL in a for loop



David Van Ginneken <mailto:davevg@xxxxxxxxx> wrote:

: : #Get and process mail
: : for my $messageID (90){

: What exactly is this supposed to do? If you just run this

: for my $messageID (90){
: print $messageID . "\n";
: }
: It outputs nothing..

Actually, it outputs "90\n". There is no reason why
the list in a 'for' loop cannot iterate over just one item.
In fact, it can make testing easier by allowing us to
substitute a list with just one test item.

foreach my $item ( @very_large_array ) {
print "$item\n";
}

Can be replaced with this for testing:

foreach my $item ( $single_test_item ) {
print "$item\n";
}


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328

.