Thanks a lot for all of your answers.
You welcome! But then, please see below.
First of all the code I've posted was just some pseudo code. I didn't want you to read too much.
That is very kind of you, but going the pseudo code route is generally not the best thing to do: one is always advised to prepare minimal but complete examples instead.
So in my script I am not opening all the time a filehandler
So what? However minimal or "pseudo" you want to stay, putting the
my $writeFh = new FileHandle ">> myout.log";
line inside or outside of your loop takes exactly the same amount of space, and of keystrokes. So why not putting it where it better belongs to, to start with?
Also the IO wait is very low, so it is really just the CPU which is having a lot work.
Granted, your code has several, bigger problems, e.g. the if (<$fh> =~ m/$item/) thingy, but are you sure? How can you say that?
I will have a look now at the iterators thing which looks little bit confusing to me as I am not that familiar with perl at all.
As I wrote above, you welcome. But why didn't you write that you already asked the very same question (link @ GG) in clpmisc? Why didn't you write there you also asked here? What did they tell you there? Why didn't you report?
For completeness, I'm pasting all the messages of the thread hereafter:
|