for looping

I run into a issue when I try to do sorting of the following with ascending order, one round of for looping seems not working, anyone knows how to use shell or perl?

$array = (5,0,3,2,7,9,8)

What algorithm are you trying to use?

in perl

@arr = sort(@arr);

or you are specific about some sorting algorithms ?