Split loop, <> line 1.
The program looks like this...
while (<>) {
## fails on linux i386 multi thread
$line = $_;
@outLine = split(/(<[^>]*>)/,$line);
## works on linux i386 multi thread
## @outLine = split(/(<[^>]*>)/,$_);
}
| [reply] [d/l] [select] |
There we go. It's very likely that it may be a bug. You're using one of those common idioms that a lot of people (including me), simply don't like. Here's how I'd write it (see <> in `perldoc perlop'):
while(my $line = <>){
...
}
Unless you're exploiting the magic of <> (you're simply reading of STDIN), or you have no idea there is any magic, i'd suggest you simply read off the filehandle you're using (as in <STDIN>).
I personally like to go all the way and use defined, as in while(defined(my $line = <>)){...}.
From perldoc perldiag
Split loop
(P) The split was looping infinitely. (Obviously, a split shouldn't iterate more times than there are characters of input, which is what happened.) See split in perlfunc.
update:
Try $line = "$_"; and see if that works (it may be that somehow $line was being aliased to $_ instead of a copy being made, and that somehow screwed up the length count -- wild guess).
MJD says you
can't just make shit up and expect the computer to know what you mean, retardo!
** The Third rule of perl club is a statement of fact: pod is sexy.
|
| [reply] [d/l] [select] |
| [reply] |
Thanks again for the feedback.
I verified that the problem isn't really with the while (<>) type of idiom nor with the assignment of a scalar. As tall man suggests those are pretty common operations and it would be utter chaos if they broke like this. Why the error messages points to line 1 is yet another question.
The problem is in the regex of the split statement. If I do as tall man suggests and remove the capturing parenthesis, the error continues. However, if I pare things down to ...
@outLine = split(/(<.*>)/,$line);
and this works as it should. Of course, this is not
the same as what I want to do, but I think it helps to isolate the problem.
So, I'm fairly near convinced there is a bug in the split regex handling of i386 multi thread. Am I missing something here?
Thanks! Ted | [reply] [d/l] |