tokuhirom's Blog

Sleep sort with AnyEvent

http://dis.4chan.org/read/prog/1295544154

use strict;
use warnings;
use utf8;
use 5.012000;
use AE;

my $cv = AE::cv();

sub f {
    my $t = shift;
    $cv->begin;
    my $timer;
    $timer = AE::timer(
        $t,
        0,
        sub {
            $timer = $timer;
            say $t;
            $cv->end();
        }
    );
}

f($_) for @ARGV;
$cv->recv();