This is meant for rough "Rosetta" comparison, and clearly the two languages have some very different idioms and distinct semantics on various features.
Foo.pm:
|
Foo.cpp:
|
I mention the C++ this twice for clarity, though these are implicit, not required, and rarely mentioned in C++. Note that static means something entirely different inside a C++ function versus outside a function. The Perl hack my $foo if 0; is not something I recommend, but does emulate C++'s static lexical variables (or as Larry calls them, "persistent" between calls).
--
[ e d @ h a l l e y . c c ]
In reply to Re: Package-Level Variables
by halley
in thread Package-Level Variables
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |