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

Re^4: read hash table from a subroutine or retrieve previously stored hash table from a file

by waytoperl (Beadle)
on Nov 20, 2013 at 02:09 UTC ( [id://1063419]=note: print w/replies, xml ) Need Help??


in reply to Re^3: read hash table from a subroutine or retrieve previously stored hash table from a file
in thread read hash table from a subroutine or retrieve previously stored hash table from a file

well, im saving array_cvs contents in hash table. What's is the other way of representation referring value. Please let know.

Replies are listed 'Best First'.
Re^5: read hash table from a subroutine or retrieve previously stored hash table from a file
by marinersk (Priest) on Nov 20, 2013 at 09:01 UTC
    Your expected output does not show arrays of values. It shows single scalar values. So your question does not make sense to me. I must be missing something.

    Let me analyze how the code aligns with your stated goals in more detail -- on the surface it simply seemed like you wanted scalar but were storing arrays.

      Okay, finally got some time to look at this.

      The full explanation is hidden behind the <readmore>tag.

      Summary: Making the following changes:

      chomp $line; $line =~ s/\s*\z//; my @array_CSV = split /,/, $line; my ($key_CSV, $value_CSV, @extraStuff) = @array_CSV; if ($hash{$key_CSV}) { warn "Duplicate key '$key_CSV'"; }; $hash{$key_CSV} = $value_CSV;

      Produces:

      C:\Steve\Dev\PerlMonks\P-2013-11-23@0553-Hash>perl testhash2.pl test.c +sv Number of Pins: 6 Stored 6 list of pins in test_RX.csv file. AVD0 => Group4 SIDDQ => Group7 C_WREN => Group1 CAL_CLK => Group1 REF_RATE[9:0] => Group3 RX_IBIAS_2_25U[4:0] => Group3

      Note: The @extraStuffis superfluous, left in for example purposes.

      So, unless I'm missing something, it looks like all you had to do was store the value instead of the array reference.

      Holler if this isn't what you were looking for.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-28 22:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found