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 to convert arrays into a string in perl?

924


Explain which feature of PERL provides code reusability?

1190


How do you give functions private variables that retain their values between calls?

929


Explain arrays in perl.

924


Comment on array slicing and range operator

932


Explain split function in perl?

974


Explain join function in perl?

934


How many data types are there in perl?

941


Create a function that is only available inside the scope where it is defined ?

978


Elaborate on perl bite-wise operators.

893


What are arrays in perl?

952


What is grep used for in perl?

911


What are perl strings?

876


How do I send e-mail from a Perl/CGI program on a Unix system?

995


You want to concatenate strings with perl. How would you do that?

861