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
How to access parameters passed to a subroutine in perl?
There are some duplicate entries in an array and you want to remove them. How would you do that?
How interpreter is used in perl?
What is v-strings?
Explain goto name?
What are prefix dereferencer?
You want to print the contents of an entire array. How would you do that?
Explain substr function in perl?
How can memory be managed in Perl?
How can we create perl programs in unix, windows nt, macintosh and os/2 ?
How would you ensure the re-use and maximum readability of your perl code?
How to close a directory in perl?
Explain the default scope of variables in perl?
List all the features of perl programming?
What can be done for efficient parameter passing in perl? Explain.