- or download this
sub f {
$h{$_}||=[]for map@$_,%h=@_;sub x{my$x=1;$x+=x($_)for@{@h{@_}||[]};$x}
+sort{x($a)<=>x$b}keys%h
}
- or download this
sub f {
$h{$_}||=[]for map@$_,%h=@_;
sub x {
...
}
sort{x($a)<=>x$b}keys%h
}
- or download this
@h{@$_}=@h{@$_}for%h=@_; - or download this
$x+=x($_)for@{@h{@_}||0}; - or download this
sub x {
1,map{x($_)}@{@h{@_}||0}
}
- or download this
@h{@$_}=@h{@$_}for%h=@_;sub x{1,map{x($_)}@{@h{@_}||0}}sort{x($a)<=>x$b}keys%h