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
Explain socket programming in perl?
Give an example of using the -n and -p option.
What is the easiest way to download the contents of a URL with Perl?
Create a function that is only available inside the scope where it is defined ?
In Perl, there are some arguments that are used frequently. What are that arguments and what do they mean?
What is the main function of cookie server?
Differentiate between use and require, my and local, for and foreach and exec and system
What are the different instances used in cgi overhead?
Which guidelines by Perl modules must be followed?
What is perl? What is the basic command to print a string in perl?
Explain about typeglobs?
Explain what is STDIN, STDOUT and STDERR?
What is it meants by '$_'?
In CPAN module, name an instance you use.
How do I do fill_in_the_blank for each file in a directory?