in reply to use bytes and length problem
The use bytes does not affect the way length works.
Rather, the $txt value is already marked as to whether it is byte or char oriented.
It really bugged me that there was no way to tell which way a string was oriented (prior to 5.8, or adding the Scalar::Utils module (IIRC the name), or more importantly in cases like this of setting the flag.
I don't know off hand if Scalar::Utils can write the desired flag setting. If not, the way we've done it 'till now is with the "taint-like trick" of matching the whole string with a trivial pattern in parens. The resulting $1 will have the byte/char persuasion that the regex was compiled under (use utf8 or no utf8). I think the bytes pragma had nothing to do with it. That may have changed in 5.8.
—John
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: use bytes and length problem
by Anonymous Monk on Mar 03, 2003 at 16:11 UTC | |
by John M. Dlugosz (Monsignor) on Mar 03, 2003 at 17:11 UTC |