write a perl script to find whether a given line of text is
starting and ending with same word or not ???
Answer Posted / vipul dalwala
Above solution ($_ =~ /^(\w+)\s+.*?\1$/) does not work for
string like "vipul on allinterview.com onvipul";
I would suggest :
if( $_ =~ /^([^\s]+)(\s.*?)*\s\1$/ ) {
print "the line is $_ \n";
}
Is This Answer Correct ? | 3 Yes | 3 No |
Post New Answer View All Answers
Enlist the advantages of using c over perl?
how to extract pin_code,phone_number,year from text file using regular expressions in perl
How does a “grep” function perform?
How to sort arrays in perl?
What are the different types of perl operators?
What is stdin in perl?
How to code in perl to implement the tail function in unix?
How do I print the entire contents of an array with Perl?
Explain lists ?
Explain perl one-liner?
what is the difference between java and cgi?
How to renaming a file in perl programming?
Remove the duplicate data from @array=(“perl”,”php”,”perl”,”asp”)
What is the function of virtual documents in cgi programs?
What is the different between array and hash in perl programming?