in reply to Re^2: du -h, sorted
in thread du -h, sorted
You're absolutely correct. Allow me to replace it by the following, clocking in at 87.
perl -e'sub h{pop=~/(...)(.)/&&{M,1e3,G,1e6}->{$2}+$1}print sort{h($b) +<=>h$a}`du -h`'
update: No wait! There's something in your idea of bitanding... Just have to get rid of the second spaceship comparator...
perl -e'sub c{pop=~/[GMK]/;(ord$&&7).1e3+$`}print sort{c($b)<=>c$a}`du + -h`'
76 strokes.
• another intruder with the mooring in the heart of the Perl
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: du -h, sorted
by hbm (Hermit) on Feb 26, 2009 at 03:00 UTC | |
Re^4: du -h, sorted
by bellaire (Hermit) on Feb 26, 2009 at 15:41 UTC | |
by hbm (Hermit) on Feb 26, 2009 at 16:28 UTC | |
by bellaire (Hermit) on Feb 26, 2009 at 19:30 UTC | |
by hbm (Hermit) on Feb 26, 2009 at 19:49 UTC | |
by bellaire (Hermit) on Feb 26, 2009 at 20:10 UTC | |
by Lawliet (Curate) on Feb 27, 2009 at 00:48 UTC |
In Section
Cool Uses for Perl