Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Source Divers: string delimiters

by Abigail-II (Bishop)
on Jul 25, 2002 at 09:45 UTC ( [id://185153]=note: print w/replies, xml ) Need Help??


in reply to Source Divers: string delimiters

strchr locates the first occurance of the second argument (a character) in its first argument (a string). It's returned as a pointer. So, if term = '[' it returns a pointer to the [ in "([{< )]}> )]}>". 5 characters later in the string, you find the closing delimiter. The sequence )]}> is repeated because they are valid opening delimiters as well.

Here's a followup question: why does the string have spaces in it?

Abigail

Replies are listed 'Best First'.
Re: Re: Source Divers: string delimiters
by japhy (Canon) on Jul 25, 2002 at 11:22 UTC
    Whitespace is no longer a valid delimiter (older Perls allowed it), and there are already measures taken to advance past the whitespace. In addition, " " is not a special case character like the brackets are. Therefore, I'll hazard a guess and say they're in there for readability. And because 5 is such a better offset than 4.

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-23 17:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found