• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 732
  • Last Modified:

Perl question mark syntax

Will someone explain to me what the question marks mean in the four places used in this statement?

if(m/DROP TABLE IF EXISTS \`?$tableName\`?/ || m/CREATE TABLE \`?$tableName\`?/){
           $inside=1
};
0
jmicorp
Asked:
jmicorp
2 Solutions
 
ozoCommented:
perldoc perlre

       Quantifiers

       The following standard quantifiers are recognized:

           *      Match 0 or more times
           +      Match 1 or more times
           ?      Match 1 or 0 times
           {n}    Match exactly n times
           {n,}   Match at least n times
           {n,m}  Match at least n but not more than m times
0
 
vikaskhoriaCommented:
The statement given by you is using a regex.
In a regex there are several meta-characters.
Like the ones specified by ozo above.

? is one of the meta-characters.

This checks 0 or 1 occurrence of the preceding character

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now