Re: perl: Split loop at...

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

 



> 
> From: Norman Gaywood <norm@xxxxxxxxxxxxxxxxx>
> 
> 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?
> 
If you have to try hard to get the problem to happen then
it isn't going to happen. Here's a shell transcript pasted
straight off an xterm. I've now tried 4 machines, all installed
straight off RedHat 8.0 and they all do it.

[telford@xxxxx telford]$ 
[telford@xxxxx telford]$ cat >test <<EOF
> #!/usr/bin/perl
> 
> while(<>)
> {
>         @x1 = split(/[\t\n ]+/, \$_);
> print \$., " ", scalar @x1, ": ";
>         foreach \$token (@x1)
>         {
>                 @x2 = split(/[,;]/, \$token);
> print scalar @x2;
>         }
> print "\n";
> }
> EOF
[telford@xxxxx telford]$ chmod +x test
[telford@xxxxx telford]$ ./test 
sdfsdf
Split loop at ./test line 9, <> line 1.
[telford@xxxxx telford]$ 
[telford@xxxxx telford]$ ./test /etc/resolv.conf 
Split loop at ./test line 9, <> line 1.
[telford@xxxxx telford]$ ./test /etc/hosts
Split loop at ./test line 9, <> line 1.
[telford@xxxxx telford]$ ./test /usr/share/doc/glibc-2.2.93/COPYING
Split loop at ./test line 9, <> line 1.
[telford@xxxxx telford]$ 
[telford@xxxxx telford]$ /usr/bin/perl -v
This is perl, v5.8.0 built for i386-linux-thread-multi

Copyright 1987-2002, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to
the
Internet, point your browser at http://www.perl.com/, the Perl Home
Page.

[telford@xxxxx telford]$ rpm -q perl
perl-5.8.0-55
[telford@xxxxx telford]$ 


The addition of "use bytes;" does fix things but unfortunately renders
my perl script incompatible with RedHat 6.2 and I don't understand why
this should relate to foreign languages... following this idea I also
tried changing the locale with encouraging results.

[telford@xxxxx telford]$ 
[telford@xxxxx telford]$ echo $LANG
en_AU.UTF-8
[telford@xxxxx telford]$ ./test
sdkfjshdf
Split loop at ./test line 9, <> line 1.
[telford@xxxxx telford]$ LANG=
[telford@xxxxx telford]$ ./test
ssdkfjsdhfe
1 1: 1
sdfsd
2 1: 1
[telford@xxxxx telford]$ LANG=en_AU.UTF-8
[telford@xxxxx telford]$ ./test
sdfsdfhkwe
Split loop at ./test line 9, <> line 1.
[telford@xxxxx telford]$ LANG=en_AU
[telford@xxxxx telford]$ ./test
wqekrjwer
1 1: 1
sdfd
2 1: 1
[telford@xxxxx telford]$ 


My default LANG setting is "en_AU.UTF-8" by the way.

So something to do with utf8 is breaking things... I still don't
understand why because all the input characters are low ASCII and should
be perfectly compatible between utf8 and ASCII. Unfortunately the
default RedHat install will choose en_AU.utf8 instead of en_AU as the
standard language for Australia but now that I know what I'm doing at
least I know how to fix things for myself.

	- Tel




-- 
Psyche-list mailing list
Psyche-list@xxxxxxxxxx
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