write a perl script to find whether a given line of text is
starting and ending with same word or not ???
Answer Posted / guest
Lets assume that the text to match is present in a file
say "data.txt".
Following program will print the line containing same
starting and ending word.
open(FILE,"data.txt") or die "cannot open file : $!";
while(<FILE>) {
if($_ =~ /^(\w+)\s+.*?\1$/) {
print "the line is $_ \n";
}
}
| Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
Elaborate on perl bite-wise operators.
What is the importance of perl warnings?
What does last statement do in perl?
What can be done for efficient parameter passing in perl? Explain.
Write syntax to use grep function?
What are some of the key features of objects in perl?
How to check the status of airplane mode (enable/disable) in perl for Android mobile?
What are numeric operators in perl?
What is grep used for in perl?
What does read () command do?
Explain use of ‘my’ keyword in perl?
What does this symbol mean '->'?
Write a program that explains the symbolic table clearly.
What is the purpose of “_file_ literal” and “_line_ literal” in perl?
What are the arguements we normally use for perl interpreter?