On Oct 15, Dan Anderson said:

>while ($foo) {
>  do_1() if ($condition_1);
>  do_2() if ($condition_2);
>  # ...
>}

Multiple conditions are evaluated there.  If $condition_1 and $condition_2
are true, both do_1() and do_2() will be done.

>while ($foo) {
>  if ($condition_1) {
>    do_1();
>  }
>  elsif ($condition_2) {
>  do_2();
>  }
>}

>while ($foo) {
>  if ($condition_1) {
>    do_1();
>    next;
>  }
>  elsif ($condition_2) {
>  do_2();
>    next;
>  }
>}

These are, in your case, identical.  An if-elsif-else block skips all the
remaining conditionals when it reaches a true one.  So you don't need
'next' statements there like you have.  They're totally redundant if
there's nothing between the end of the if-elsif-else block and the end of
the while block.

But what's the speed concerns here?  This is negligable.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to