Where is the open curly missing here? #!/usr/bin/perl
@array = (5,3,2,1,4); for ($i=0; $i<$n-1; $i++) { ( for ($j=0; $j<$n-1-$i; $j++) if ($array[$j+1] < $array[$j]) { /* compare the two neighbors */ $tmp = $array[$j]; /* swap $array[j] and $array[j+1] */ $array[$j] = $array[$j+1]; $array[$j+1] = $tmp; } } foreach $elem (@array){ print "$elem"; }