in reply to Re^4: Why is @flds not imported? (%INC)
in thread Why is @flds not imported?
mem tells perl to use the in-memory copy of Fields (via adding it to the appropriate perlvar).
I put a "use mem" inside any of my modules that need to be used in the same file. I also add a '1' at the end of the module, so if I later cut/paste the module out to a separate file, it shouldn't require modification.
I also, often, use mem to insert "1-liner" BEGIN-needing assignments, as it looks a bit cleaner (IMOpinion), than equivalent the equivalent 1-liner using BEGIN{}. For multiple lines or, especially, when needing code, I tend more toward using an actual BEGIN block these days.
I could use any module that ignores it's parameters for the same purpose, but mem guarantees it won't pay attention to their content, so its short and convenient. Ikegami used an equivalent assignment to some perlvar to do the same, but I often forget the var (or confuse it with INCLUDE), thus find mem easier to remember. :-| (*str8 face*)
|
|---|