in reply to while condition bubbleSort
$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.
|
|---|