#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; my @arr = (5, 3, 2, 1, 4); my $i = 0; while ($i < $#arr) { # Uncomment the following line to see the progress: # say STDERR "# @arr[ 0 .. $i ] * @arr[ $i + 1 .. $#arr ]"; if ($arr[$i] > $arr[$i+1]) { @arr[$i, $i+1] = @arr[$i+1, $i]; --$i if $i; } else { ++$i; } } say "@arr";
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
In reply to Re: How do i sort an numeric array without using sort function. Is ther any way to sort it just with loop in perl??
by choroba
in thread How do i sort an numeric array without using sort function. Is ther any way to sort it just with loop in perl??
by Tabish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |