Perl Programming Question:

Download Job Interview Questions and Answers PDF

Why are not Perls patterns regular expressions?

Perl Programming Interview Question
Perl Programming Interview Question

Answer:

Because Perl patterns have backreferences.
A regular expression by definition must be able to determine the next state in the finite automaton without requiring any extra memory to keep around previous state. A pattern /([ab]+)c1/ requires the state machine to remember old states, and thus disqualifies such patterns as being regular expressions in the classic sense of the term.

Download Perl Programming Interview Questions And Answers PDF

Previous QuestionNext Question
What is the output of the following Perl program?
1 $p1 = "prog1.java";
2 $p1 =~ s/(.*).java/$1.cpp/;
3 print "$p1n";
What does Perl do if you try to exploit the execve(2) race involving setuid scripts?