Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: logic for smart quotes - what does this code mean?

by Gorilla (Sexton)
on Jan 17, 2003 at 07:11 UTC ( #227620=note: print w/ replies, xml ) Need Help??


in reply to logic for smart quotes - what does this code mean?

Your guess of the result is wrong (I will explain why), I have carefully read the whole package, and believe the actually result should read:

stuff ``passage one'' more stuff ``passage two'' stuff

Some more detailed explanation:

$quote is just the reference to an internal flag $ptQuote, which is used GLOBALLY to store the quotes conversion status.

For example, if you have this piece of two-line text in your pod:

abcd"ef gh"ijk
Although they will be processed as two separate lines, but as the quote status is rememebred globally, those two lines would be converted correctly to:
abcd``ef gh''ijk
The reason you had the wrong guess, is that you didn't realize $ptQuote is initially set to 0, so the first time you execute that piece of code you showed, the if condition is not satisfied, thus the if block is not executed.


Comment on Re: logic for smart quotes - what does this code mean?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://227620]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2014-12-27 02:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls