I
Ilya Zakharevich
[A complimentary Cc of this posting was NOT [per weedlist] sent to
Ilya Zakharevich
Or one can try something like
my $four = substr $in, 0, 4;
print 'OK' if length $four == 4 and
0 <= index "0123456789\x{FFFFFFFF}9876543210", $four;
for its speed. However, the Unicode overhead can eat the advantages
of fewer opcodes to dispatch...
Yours,
Ilya
P.S. Here I use the fact that utf8 character repertuar is larger than
UTF-8 one.
Ilya Zakharevich
[A complimentary Cc of this posting was NOT [per weedlist] sent to
Graham Drabble
I have a file that contains a list of numbers. I'm trying to process
the file to find out how many rows start with 4 consecutive digits
(either ascending or decending). Currently I've got
I'm puzzled at all complications: what is wrong with using something like
my $four = substr $in, 0, 4;
print 'OK' if length $four == 4 and
(0 <= index '0123456789', $four or 0 <= index '9876543210', $four);
Or one can try something like
my $four = substr $in, 0, 4;
print 'OK' if length $four == 4 and
0 <= index "0123456789\x{FFFFFFFF}9876543210", $four;
for its speed. However, the Unicode overhead can eat the advantages
of fewer opcodes to dispatch...
Yours,
Ilya
P.S. Here I use the fact that utf8 character repertuar is larger than
UTF-8 one.