les, ok.
I thought there is now newbies reading this.

while $check and $counter<$max

once you have the condition, you make hit $check.
this is the ultimate-correct-way
_________________________
!

download KiXnet