in reply to Re: Simple bubble sort
in thread Simple bubble sort
See it in action below....@$array[$i,$i+1] = @$array[$i+1,$i];
#!/usr/bin/perl -wT use strict; my $arrayref = ['A','B','C','D']; print "Before: ", join(' ',@$arrayref), "\n"; @$arrayref[1,2] = @$arrayref[2,1]; # assign into an array slic +e print "After : ", join(' ',@$arrayref), "\n"; =output Before: A B C D After : A C B D
-Blake
|
|---|