Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: IF condition that doesnt workby vitoco (Hermit) |
on Dec 23, 2009 at 14:34 UTC ( [id://814102]=note: print w/replies, xml ) | Need Help?? |
My problem its when i need to check the line using ReGex, i have the check if the lines named (hwUserField7) exists, and if dont, it must use the data store in hwUserField3 to look for in the has i had readed from the file, then must write the value referenced from this key in the hash as a new line. My problem its i dont able to put into the if contition of the flag to check if exists the line. Please note that in your code, the conditions use "hwAssetUserField7" and "hwAssetUserField3". Also, you are reading that XML file line by line and testing each for the whole pattern "<tag>data</tag>". Is it possible that the opening tag to be in one line of the file and the closing tag to be in another? Then you should slurp the entire file and then perform the IFs. BTW, if both matching tags are always in the same line, you can use if (cond3) {...} elsif (cond7) {...}. Instead of uncompressing->processing->recompressing files, I would open files through a pipe, to get data uncompressed on the fly, and do the same to the output:
It will save space on disk, but I'm not sure if this performs.
In Section
Seekers of Perl Wisdom
|
|