$sorted is a flag that is set false each time through the loop when a swap is required. It is set false initially so that the while loop executes at least once.
Note that Perl provides sort so writing your own is seldom needed.
In reply to Re: while condition bubbleSort
by GrandFather
in thread while condition bubbleSort
by santosh_br
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |