in reply to Re: Sort routine runs into infinite loop
in thread Sort routine runs into infinite loop

So much code...

my @array=(12,6,2,9,15); foreach (sort { $a <=> $b } @array) { print $_, " "; }

Replies are listed 'Best First'.
Re^3: Sort routine runs into infinite loop
by oiskuu (Hermit) on Jan 02, 2016 at 18:47 UTC

    Most assuredly, your code does not implement bubble sort.

    And if we are going to golf it, how about this:

    perl -E 'say"2 6 9 12 15"'

Re^3: Sort routine runs into infinite loop
by Laurent_R (Canon) on Jan 02, 2016 at 19:51 UTC
    So much code...
    $ perl -e 'print "$_ " for sort {$a <=> $b} qw {2 6 9 12 15}' 2 6 9 12 15
      yep, always shorter and finishing with a string :pp