Re: perl: Split loop at...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 10, 2003 at 04:12:13PM +1100, Telford wrote:
> I've tried this on two different RH8.0 machines:
> 
> 
> #!/usr/bin/perl
> 
> while(<>)
> {
> 	@x1 = split(/[\t\n ]+/, $_);
> 	foreach $token (@x1)
> 	{
> 		@x2 = split(/[,;]/, $token);
> 	}
> }
> 
> 
> Feed it almost any input and you get something like:
> Split loop at ./test line 8, <> line 1.
> 
> I've seen a few other reports around of a similar error
> but no one has actually explained what causes it.
> There is no discussion in perldoc -f split that explains
> what might be generating this error and I'm scratching
> my head as to how to get around it.

I changed your program slightly (un-indented lines) so I could see what
might be going on:

#!/usr/bin/perl

while(<>)
{
        @x1 = split(/[\t\n ]+/, $_);
print $., " ", scalar @x1, ": ";
        foreach $token (@x1)
        {
                @x2 = split(/[,;]/, $token);
print scalar @x2;
        }
print "\n";
}

But I could not find any input that gave the split loop error message.
The error message is mentioned in man perldiag but it just points you
to the perldoc -f split page. And as you said, this says nothing about
this error.

Could you provide an input line that creates the problem?

Cheers.
-- 
Norman Gaywood -- School of Mathematical and Computer Sciences
University of New England, Armidale, NSW 2351, Australia
norm@turing.une.edu.au     http://turing.une.edu.au/~norm
Phone: +61 2 6773 2412     Fax: +61 2 6773 3312



-- 
Psyche-list mailing list
Psyche-list@redhat.com
https://listman.redhat.com/mailman/listinfo/psyche-list

[Index of Archives]     [Fedora General Discussion]     [Red Hat General Discussion]     [Centos]     [Kernel]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux