Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Working with Hashes

by QuillMeantTen (Friar)
on Jun 12, 2016 at 11:52 UTC ( [id://1165417]=note: print w/replies, xml ) Need Help??


in reply to Working with Hashes

Update:

  • I thought you wanted the hashes stored in another file, if that's not the case then have a look at getopt::long for argument passing.

    else you can just test argv0:
    if($ARGV[0] eq "first"){ dump $firsthash; }
  • Disregard above, I got it right the first time... I think?
  • Updated the part about a separate conf language for clarification


  • It seems like it boils down to HOW you are storing your hashes.
    If you are only interested in pure data storage, then you might want to have a look at the YAML format. If you want to be able to extend your application and dont care about the computation cost, create a package, load it and export whatever you need.

    On the other end of the spectrum (I put this possibility last for a good reason) if you want to use said hashes for configuration purposes but still need some logic to be applied to them (from within so you can have a consistant api and thus blurring the line between configuration files and "proto plugins") you might want to have a look at a specialised language(lua) and its just in time compiler. As it should give you C like performances its something to explore as well. You can even get it to play nice with perl.

    Thats it for the doc part, what have you tried? You could easily use the do command after filtering the file content to select what you want to execute, or (cleaner imo) go the package way.

    Hope that helps, keep in mind its only my brand of fishing so you might want to keep asking around.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1165417]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2024-04-19 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found