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

Re: Dereferencing Mystery

by graff (Chancellor)
on Jan 08, 2006 at 00:39 UTC ( [id://521763]=note: print w/replies, xml ) Need Help??


in reply to Dereferencing Mystery

Your use of the term "flat file" does not make sense to me. I can't figure out what you really mean when you say:
The flat file has this
@HASHES = ( \%Data_Directories_fetch, \%DataDirectories_erase, \%Program_fetch, \%Program_erase, \%Configuration_and_Table_Files_erase, \%Configuration_and_Table_Files_fetch, \%Create_Database, \%Load_Database );
That's just a snippet of perl code, building an array from a list of references to hashes. It is not a "flat file", because a flat file is a stream of plain-text data, usually structured as a table (each line of text is a row, containing one or more columns).

When you say "I am attempting to read a flat file that describes an array of hash references...", I don't understand how a flat file can do this -- hash references can only exist as such in a running perl script. A flat file can contain the data that would be loaded into a hash by a perl script, and then you can use a reference to the hash within that script. But the flat file has nothing to do directly with hash references.

You'll need to clarify what it is you are trying to do.

Replies are listed 'Best First'.
Re^2: Dereferencing Mystery
by Anonymous Monk on Jan 08, 2006 at 01:02 UTC
    Flat file isn't correct! The file is actually a listing of mostly hashes with default values to be used by a menu. The user of the menu makes some changes in the selections and it's these changes I want to save to disk for another process to read.

    %Program fetch for example

    %Program_fetch = ( "/airreba/procs" => "Y", "/reba/bin" => "Y", "/reba/onetime" => "Y", "/reba/perlib" => "Y", "/reba/shlib" => "Y", "/xcape/bin" => "Y", "/xcape/bin_util" => "Y", "/airreba/tables" => "Y", );

    Edit: g0n - code tags

      general comment: If the only choices are on & off ("Y" & something else), use "boolean" values instead -- it will make things a lot easier and cleaner cause you'll avoid code like if($foo eq 'Y') (or worry about case).. use 1 (or another non-zero number) for true and 0/undef for false. Then you can just do if($foo). (Depending on the usage you could just do if(exists $someHash{someKey}) as well ..). A good reference is True or False? A Quick Reference Guide

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-20 04:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found