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 is the difference between use and require in perl?

849


How to remove a directory in perl?

981


Explain cpan?

965


What is “grep” function in perl?

984


Where the command line arguments are stored and if you want to read command-line arguments with Perl, how would you do that?

1077


How to create a directory in perl?

1062


What happens in dereferencing?

1027


For a situation in programming, how can you determine that Perl is a suitable?

874


What are scalars in perl?

944


What does 'do' statement do in perl?

983


Explain about typeglobs?

921


What does cgi program store?

899


What does next statement do in perl?

981


How can I display all array element in which each element will display on next line in perl ?

914


What is perl? What is the basic command to print a string in perl?

863