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


in reply to Perl Program Exits.

Are you running this on Windows, by double clicking a file icon? If I recall correctly Windows automatically closes the command-line window once the program has finished running when a program has been started this way, but there is a way to change that behaviour somewhere by right clicking the file and going into its properties.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'