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
What package you use to create a windows services?
Explain which feature of PERL provides code reusability?
Which of these is a difference between Perl and C++ ?
What is the difference between localtime() and gmtime() functions?
Explain cpan?
How do you you check the return code of a command in perl?
What does file test operators do in perl?
Why -w argument is used with perl programs?
Why to use perl?
What is stdin in perl?
What is the purpose of “_file_ literal” and “_line_ literal” in perl?
Mention what is cpan?
What are the logical operators used for small scale operations?
Explain the various characteristics of perl.
How to check the status of airplane mode (enable/disable) in perl for Android mobile?