sorry, I didn't mean to make you guess.

GOAL:find the common Italian number in both files that contains both Spanish and French translations (did that). Then,I added complexity to my learning by adding other number translations (german, english) and build the match file to contain these.

lastly, to dump the numbers that don't have a matching Italian number in any.

things I'd hope to learn.

1) HASH_REF 2) Print HASH_REF 3)conditionals (if,else,define) with hash_ref 4)Concat ( now, I know needs a (.) THANKS TO YOU! although I saw an example where it didn't and that's what I followed) 5) play with SPLIT to remove =,spaces:/ and stuff.

Questions for clarity

:

EXAMPLE snippet1 I modeled my concat syntax, why the Difference? why mine didn't work?

chomp; my($col1,$col2,$rest)=split(/\t/); my $ckey="$col1$col2" #<= NO PERIOD!

question 2, what does this piece do?can you explain your addition of "!"? I'm thinking, if the $num is UNDEF then go into loop...is this thinking correct?

if (!defined $num){

Output of Not a match of Italian number in either file has a printing bug I would like to remove. Please note, there is no French number in spot1 and so it gives ",," instead, how to remove these?

nouve =>nueve,,neun uno =>uno,,eins

I build my hash as follows:

Italian => Spanish, French, whatever

so in this case, one number is not found in the other and so the spot is just filled with ",,"

NEED HELP:how to order the numbers on output?, any ideas???

CORRECTED my hash structure like this since concat didn't print like I wanted

my ($ita,$fren,$num1,$num2)= split(/[=\s,]+/); #creates col of num +bers $hash{$ita}[1]=$fren; #now hash_ref format will look like this: it +a=> spa , fren #define if there is are numbers in position 3 and 4 concat to posi +tion 3 if (defined ($num1)){ $hash{$ita}[3]=$num1; # % looks like this: Ita=> Spa, Fren, R +andNUM[3] } if (defined $num2){ $hash{$ita}[4]=$num2; # % looks like this Ita=> Span,Fren, Ra +ndnum[3]?(ifdefined), Randnum[4] } }

somehow I feel there is a better way to do this...can hash of hashes be better? I don't know yet, I guess I need to learn that next...

GRAZIE MILLE


In reply to Re^2: concatenation 2 values then pushing to a hash_ref by perlynewby
in thread concatenation 2 values then pushing to a hash_ref by perlynewby

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.