Sorry for the obscurities. As I said, I use hashes of hashes to store dictionary entries. So %edict{0} contains the first entry (0 is the key to the embedded hash) and &edict{0}{english} contains the english translation. That's mostly one word like "house" etc. but sometimes there are entries like "office; court; ....". That's why the split looks for "; ", since there is always a whitespace after the semicolon.

What I'm trying to do is to split the entry with more than one english words, put the them in the array @foo and then take the first word from @foo, put it in another array @engdict with other information belongs to it, so that I will have two seperate scalars in @engdict: One is office : xyz, and the other is court : xyz.

So that's what the code must do: 1. Find the entry about english translation with more than one word inside, seperated by "; " 2. Put them seperately in the array @foo 3. Take the first word from @foo and put it in $engdict[$no] with other information 4. Add one to $no 5. Take the second word and put it in $engdict[$no+1] and so on.

The problem is this is not working as I thought. The $foo[$_] is always empty so I think I'm doing something wrong with the split() command but I can't see the mistake. So here is my question: Can you tell me the mistake here?

Thank you


In reply to Re: split() Problem by Omukawa
in thread split() Problem by Omukawa

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.