in reply to 12 days of Perl?

If you are also interested in canonical and idiomatic solutions (that probably won't be shorter but might give you some ideas how to approach the problem differently), check Exercism.io.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]