in reply to Several stupid questions about subs

This is one of my favorite reasons for using Perl “objects.”   The standard way of doing this in Perl might not conform to anyone’s college textbook, but it nevertheless is quite practical.   An object is basically “a blessed hash,” and as such it contains both code and data in one convenient, self-ecapsulated “thing.”   Each instance of an object neatly stands by itself, with easy access to “its” data.   Variables declared within the package are naturally shielded from anyone outside.   And so on.   It is a pragmatic solution to issues kind-of like the ones you are considering now ... and never mind your college textbook, anyway.

Replies are listed 'Best First'.
Re^2: Several stupid questions about subs
by Argel (Prior) on Apr 13, 2011 at 21:21 UTC
    How are mentioning advanced topics like 'bless' and 'package' in a thread where the OP is not even familiar with some of the basic concepts of Perl helpful? Or pragmatic for that matter? I admire your enthusiasm to help, but please think about the knowledge level of the people you are trying to help when posting!

    Elda Taluta; Sarks Sark; Ark Arks

      /me nods...

      I certainly do not mean to “shoot over the head of” anyone, let alone purposefully.   But even if every technical detail of what I outlined (inadvertantly...) is too esoteric, I hope that the essential notion is both useful and clear, and relevant.