#!/usr/bin/env perl use strict; use warnings; use Data::Printer; my @unsorted = qw( 041351920234 Rabbit 0343120 041271024500 0430870 Ap +ple 041460301399); my @sorted = sort { $a <=> $b || $a cmp $b } @unsorted; p @unsorted; p @sorted;
Is your way more efficient memory-wise? Also, both of our approaches are giving me warnings like: Argument "Rabbit" isn't numeric in numeric comparison (<=>) at....
In reply to Re^2: Sorting Numbers & Text
by frozenwithjoy
in thread Sorting Numbers & Text
by PriNet
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |