http://www.perlmonks.org?node_id=716510


in reply to Generate the perl sequence 1, 11, 111, ....

Such a home work assignment should immediately trigger the term 'recursion'. The best way to impress your teacher is:
perl -E'sub _{push@_,say@_;&_}_'
It even starts with 0 1's, for extra credits.

If you want to golf, you might want to try

perl -E'{$_.=say;redo}'