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

How do I read command-line arguments with Perl?

1018


How to replace perl array elements?

953


What is perl I used for?

960


Define say() function in perl?

968


Show the use of sockets for the server and client side of a conversation?

892


Perl regular expressions are greedy" what does this mean?

923


Enlist the advantages of using c over perl?

918


What happens when you return a reference to a private variable?

1006


Which functions in perl allows you to include a module file. State their differences.

950


What does length(%HASH) produce if you have thirty-seven random keys in a newly created hash?

1024


what is perl language?

930


Write a program to decode the data in the form using cgi programming

1047


What are perl strings?

889


Explain the difference between declarations of 'my' and 'local' variable scope in perl?

922


What are scalars in perl?

964