XP is just a number | |
PerlMonks |
Re: Render numeric sequence as array of lettersby Not_a_Number (Prior) |
on May 20, 2003 at 17:35 UTC ( [id://259520]=note: print w/replies, xml ) | Need Help?? |
Maybe a bit late, but there's an issue in the OP's code that nobody else has explicitly mentioned, namely that the first line: my @original_array = qw(5, 100, 2, 8, 40);will actually put the commas in @original_array along with the numbers themselves, as would have been pointed out if -w had been on In this instance, it doesn’t matter much, since if I understand correctly, perl will uncomplainingly do a numerical sort on strings as long as each begins with what it interprets as a number. In other cases, however, putting unneeded commas in a qw(list) could lead to some surprises. Try this:
Dave
In Section
Seekers of Perl Wisdom
|
|