Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Linking and Combining Two Arrays

by merlyn (Sage)
on Feb 01, 2010 at 18:39 UTC ( #820813=note: print w/ replies, xml ) Need Help??


in reply to Linking and Combining Two Arrays

When you have a lot of similar names like this:

$D_agc =~ s/\s*$//; $D_market =~ s/\s*$//; $D_analysis_code =~ s/\s*$//; $D_item =~ s/\s*$//; $D_customer =~ s/\s*$//; $D_key_val2 =~ s/\s*$//; $D_key_val3 =~ s/\s*$//; $D_terms_code =~ s/\s*$//; $D_audit_seq =~ s/\s*$//; $D_aud_date =~ s/\s*$//; $D_aud_time =~ s/\s*$//; $D_opr_id =~ s/\s*$//; $D_action =~ s/\s*$//; $D_column_name =~ s/\s*$//; $D_new_value =~ s/\s*$//; $D_old_value =~ s/\s*$//; $D_tot_canc_qty =~ s/\s*$//; $D_tot_ord_qty =~ s/\s*$//; $D_tot_ship_qty =~ s/\s*$//; $D_ship_complete =~ s/\s*$//; $D_unit_price =~ s/\s*$//;
It's a clue that you have a data structure, not a bunch of unrelated scalars. Consider the use of a proper hash to hold these items.

-- Randal L. Schwartz, Perl hacker

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.


Comment on Re: Linking and Combining Two Arrays
Download Code
Re^2: Linking and Combining Two Arrays
by roguez33 (Initiate) on Feb 01, 2010 at 18:51 UTC

    You are correct they are data structures!

    The key values are "item" ( $c_1_ITEM and $D_item) in each array.

    Can the be more than one value per key in a hash array?

      Can the be more than one value per key in a hash array?
      Yes, in HASHES OF ARRAYS

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (12)
As of 2014-09-22 16:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls