in reply to split() Problem
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: split() Problem
by moritz (Cardinal) on Jul 22, 2008 at 10:08 UTC | |
by Omukawa (Acolyte) on Jul 22, 2008 at 10:52 UTC |