+1 from me for that, bliako. Thank you. I'm sure others reading here will be helped by it. As for me, I'm lost at the very first line of your example code where it appears you are assigning a hash to a scalar. If I ever tried coding something like that, the program would likely put up a fatal error, and I would have no clue what I'd done wrong so as to fix it. I see code like yours out there regularly. It's just too much over my head, so I bring my head back under those clouds and do the best I can with what I can understand. I've read the OOP sections of "Programming Perl" multiple times, I've poured over others' code aplenty, yet my mind has never grasped it. My usage of OOP is limited to copy/pasting code that is sufficiently self-contained as to need little adaptation. It's a bit like copying the answers on a math test--if the teacher suspected me of cheating and asked me to do some novel problem, showing my work, I'd fail for sure.
Essentially, I've got to know the ways to program without OOP due to my limitations--which means no use of classes, methods, blessings, arrayrefs, hashrefs, etc. unless I can just copy/paste a working solution from somewhere. I don't even understand the why of abstractions--like why in the world is it supposed to be better? Much less so can I grasp the how or the syntax of it.
From what you're saying about using hashrefs, honestly, it sounds almost like a substitute for globals--just in a more "politically correct" form. But that probably shows I understand nothing about hashrefs.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.