Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Hello monks,

I would like to use an external file that contains all of my hashes and then reference that file in my scripts.

I'm not sure where to begin, or what search terms are best to learn this process. any pointers and or links to learn are welcome.

I've included a sample of my current hashes that I'm using.

%Real_time = ( 0 => 'No', 1 => 'Yes', ); %Date_format = ( 0 => 'MM/DD/YY', 1 => 'DD/MM/YY', 2 => 'YY/MM/DD', );

Also I don't think I'm correctly calling/reading my file as perl does not appear to report it available using the following code...

BEGIN { no strict 'refs'; no warnings 'uninitialized'; printf("package %s\n", __PACKAGE__); for (qw( unit_id )) { printf("%s: exists:%s defined:%s prototype:%s\n", $_, exists(&{$_}) || 0, defined(&{$_}) || 0, prototype($_), ); } }
returns unit_id: exists:0 defined:0 prototype:
sorry I forgot that little bit.

thank you


In reply to using external file for hashes by r0adawg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2022-08-17 03:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?