@d=split,$o{$d[1]}{$d[0]}=$d[2]for<>;($m,$y)=(sort{$a<=>$b}keys%o)[0,-1];($n,$x)=(sort{$a<=>$b}map{keys%{$o{$_}}}keys%o)[0,-1];for$r($m..$y){for($n..$x){$o.=($o{$r}{$_}||'-')}$o.="\n"}print$o
Note that non-ascii characters in the above source code will be escaped (such as \x9f).