Perl Programming Question:

Download Job Interview Questions and Answers PDF

What is the output of the following Perl program?
1 $p1 = "prog1.java";
2 $p1 =~ s/(.*)\.java/$1.cpp/;
3 print "$p1\n";

Perl Programming Interview Question
Perl Programming Interview Question

Answers:

Answer #1
What is the output of the following Perl program?
1 $p1 = "prog1.java";
2 $p1 =~ s/(.*).java/$1.cpp/;
3 print "$p1n";

prog1.cpp

Answer #2
prog1.java

Download Perl Programming Interview Questions And Answers PDF

Previous QuestionNext Question
I want users send data by formmail but when they send nothing or call it from web site they will see error. codes in PHP like this: if (isset($HTTP_POST_VARS)){ .......... } else{ echo ("error lalalalal") } How it will look in perl?Why are not Perls patterns regular expressions?