Re: MySQL in a for loop



On 7/27/05, Charles K. Clarkson <cclarkson@xxxxxxxxxx> wrote:
> 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.
You are absolutely right. Teaches me to glance really fast at the
output. ;-) I also made a typo in the last ->finish command. But he
can get the idea.
>
> 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
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx
> For additional commands, e-mail: beginners-help@xxxxxxxx
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
.



Relevant Pages