... (block 1) use encoding "greek"; ... (block 2) no encoding; ... (block 3)The actual effect is encoding in block 2, but no encoding in block 1, and 3. It is not as you expected that, becasue that no encoding comes the last, the whole module is no encoding.
... (block 1) use encoding "greek"; ... (block 2) use encoding "greek"; ... (block 3) no encoding; ... (block 4)The actual effect is encoding in block 2 and 3, but no encoding in block 1 and 4. Again, according to your interpretation, the whole module is not encoding becasue that 'no encoding' is the last in the physical sequence. And again your interpretation is wrong.
...(block 1) use encoding "greek"; ...(block 2)In a script, you say:
use packageA; ...(block3)In this example, you should expect, block 1 not encoding, block 2 encoding. Block 3? Now this is what the document means: block 3 is encoding, because that use encoding in packageA is not block lexical, but per script, and your script now 'contains' packageA, that use encoding you put in packageA does affect the rest of the script, not just to the end of packageA.
...(block 1) use encoding "greek"; ...(block 2)In a script, you say:
use packageA; ...(block3) no encoding; ...(block 4)It would be encoding in block 2 and 3, no encoding in 1 and 4. The reason block 3 is encoding is that, the 'use encoding' you put in packageA is per script, so it even affects things outside the package, until meets a 'no encoding' later in the script.
...(block 1) use encoding "greek"; ...(block 2) no encoding; # at the end of packageAIn a script, you say:
use packageA; ...(block 3) use encoding "greek"; ...(block 4)Block 1, 3 not encoing, 2 and 4 encoding, exactly meets what you visually see on the screen, what you see is what you get. So the best practice is to always say "no encoding" at the end of your module, if you said any "use encoding" earlier in your module. This makes sure that your module's encoding does not affect any other module/script unexpectedly.
In reply to Re: Unicode, regex's, encodings, and all that (Perl 5.6 and 5.8)
by pg
in thread Unicode, regex's, encodings, and all that (Perl 5.6 and 5.8)
by John M. Dlugosz
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |