Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Elaborate on perl bite-wise operators.

962


What is the importance of perl warnings?

1225


What does last statement do in perl?

1067


What can be done for efficient parameter passing in perl? Explain.

1083


Write syntax to use grep function?

1018


What are some of the key features of objects in perl?

988


How to check the status of airplane mode (enable/disable) in perl for Android mobile?

3133


What are numeric operators in perl?

1000


What is grep used for in perl?

978


What does read () command do?

977


Explain use of ‘my’ keyword in perl?

977


What does this symbol mean '->'?

1078


Write a program that explains the symbolic table clearly.

1007


What is the purpose of “_file_ literal” and “_line_ literal” in perl?

961


What are the arguements we normally use for perl interpreter?

1021