ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is it possible to parse something in XML into a perl hash like once, and make any future refference to the hash and not the XML? Like, create a totally new hash file (like .jor) to replace each XML file, keeping the same name, and then if the hash file is missing, look for the XML file and parse that?
I'm a bit new to this, and the only guides I find are for parse-right-now-and-keep-in-the-script sort of situation.
Personally, I happen to be of the opinion that tie is a feature that is most-often abused, to the serious detriment of the program(s) in question...
To my way of thinking, you should imagine that you are fundamentally dealing with an object, whose solitary purpose in life is to enable you to work with "a Perl 'hash'" that is somehow sourced from "an XML file" (in a fashion that is known only to the object).
So... the basic "method" exposed by this object [class] will be one that, given a key, returns the value corresponding to that key ... exactly as a hash would do. But it has an awareness that "its values come from such-and-such a file," and therefore that if it has not yet loaded that file into memory it should first do so."
Any programming language .. but especially a language like Perl .. challenges you to strike an appropriate balance between "what" and "how." That balance should usually be resolved in favor of "what," but the language (like Perl) might instead try to tilt your judgement (quite erroneously...) in favor of "how." It's a bias that is very hard to shake.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.