in reply to Re: Re: Newbie Question on pushing Arrays
in thread Newbie Question on pushing Arrays

This odd behavior occurs because of how you sort the list of primes: @primes = sort @primes; The default sort uses string comparison. Just like 'aa' comes before 'b', so '11' comes before '2'. What you meant is to sort the array numerically: @primes = sort { $a <=> $b } @primes; However, since you're creating the array in order to begin with, sorting it is redundant. You should just remove the sorting line, and you script will work great.