in reply to Sorting numbers
Oops! Misread the problem. Here's something that works correctly
$, = $/; $a[$_] = ++$line while <>; print map $a[$_] || (), $[ .. $#a;
I goofed and wrote down the right answer to the wrong problem. Oops! This works if all of your numbers are positive.
$, = $/; undef @a[<>]; print grep exists $a[$_], $[ .. $#a;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Sorting numbers (!exists)
by tye (Sage) on Jun 02, 2003 at 20:32 UTC |