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...

how to find a substring in a string without using substr
built in functions, and print the substring found

Answer Posted / lucky

#!/usr/bin/perl
print"enter string
";
$str=<stdin>;
print"enter substring
";
$substr=<stdin>;
if($str=~$substr){
    print"valid
";
}
else
{
print"invalid
";
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which statement has an initialization, condition check and increment expressions in its body? Write a syntax to use that statement.

1070


How to close a file in perl?

1003


Explain the use of 'my' keyword in perl?

1070


What are hashes?

991


What does the q{ } operator do?

959


How to turn on Perl warnings? Why is that important?

1135


Define say() function in perl?

1013


How will you declare a variable in perl?

1019


What is q (single q) operator in perl?

1173


How to renaming a file in perl programming?

1113


what is the difference between java and cgi?

1137


Hi, I am a accountant. I am preparing a balance sheet but because of staff shortage and time pressures I cant complete it on time. There is lot of common data with last years which I need not retype and I can manage by editing last year’s balance sheet ? Is their any software on net where I can do this easily??

2197


How many ways can we express string in Perl?

1013


What is use of ‘->’ symbol?

1056


What are the different string manipulation operators in perl?

960