|laziness, impatience, and hubris|
Different perl behavior between V5.10 and V5.14by markseger (Beadle)
|on Apr 01, 2013 at 12:02 UTC||Need Help??|
markseger has asked for the
wisdom of the Perl Monks concerning the following question:
I have no idea if this is perl or ubuntu, as this works find on an Ubuntu/natty distro running perl 5.10 and does not do what I expect on Ubuntu/precise running perl 5.14.
The simple problem statement is I want to tail a file and count various types of entries, writing intermediate counters to a file every second. My solution, which has been running just fine for over a year is to simply set a timer with ularm to wake me every second at which time I write my counters and continue.
To reproduce the behavior, first you create the file xyz and then run the script which I've posted after the results. Then in a different window run the command: "echo test >> xyz" a couple of times.
On natty you see:
In other words it stays inside the loop processing the tail command. But the identical test on precise produces the following, noting which each new line written to the file it breaks out of the inner loop:
I've been trying a variety of things to get this to do what I want and am out of ideas. Here's the code: