Probably crossposted to
StackOverflow. Crossposting is OK, just please mention it, so people not attending both sites don't waste their efforts hacking a problem already solved at the other site.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]