Re: MySQL in a for loop
- From: davevg@xxxxxxxxx (David Van Ginneken)
- Date: Thu, 28 Jul 2005 09:04:01 -0400
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>
>
>
>
.
- References:
- Re: MySQL in a for loop
- From: David Van Ginneken
- RE: MySQL in a for loop
- From: Charles K. Clarkson
- Re: MySQL in a for loop
- Prev by Date: Re: defined on hash value does not work in my code :(
- Next by Date: Compiling Perl with Watcom
- Previous by thread: RE: MySQL in a for loop
- Next by thread: Trying to scape data out of HTML
- Index(es):
Relevant Pages
|