in reply to Can I do single-file, Object oriented perl?

Yes, you can. The easiest way, is to create your .pl file as normal, with the #! line at the top, and all the code that uses your modules. Then put your module code, ie each of the packages, at the bottom.

If you prefer the script code at the bottom, put "package main;" after the package code, to flip back to the main package, and you don't need to end the file with 1;

If you want more specific answers, please explain *which* errors you got while putting prints in (and give the exact code you tried, or a simplified version thereof).

C.

  • Comment on Re: Can I do single-file, Object oriented perl?