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

What are the advantages of perl programming?

941


Explain lists and ivalue?

891


What are the various file operations in perl. Explain with example.

873


Write syntax to add two arrays together in perl?

871


Explain what is perl language?

866


What is stdin in perl?

913


How to concatenate strings in perl?

986


What are the various perl data types based on the context?

886


List the operator used in Perl?

919


What is the use of -t?

906


How do you find the length of an array?

903


What does localtime() do in perl?

942


Write a program that shows the distinction between child and parent process?

870


Explain perl. When do you use perl for programming?

834


How do I print the entire contents of an array with Perl?

897