how to find a substring in a string without using substr
built in functions, and print the substring found
Answers were Sorted based on User's Feedback
Answer / yashwanth
$r="YASHWANTH";
@n=split (//,$r);
print "@n\n";
@t=splice(@n,0,3);
print "@t\n";
$r=join("",@t);
print "$r\n";
~
~
| Is This Answer Correct ? | 10 Yes | 2 No |
Answer / 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 |
Answer / garg
#! /user/bin/perl
$str="Yashwanth";
$n="wan";
if ($str=~ $n)
{
print $n;
}
| Is This Answer Correct ? | 4 Yes | 6 No |
What is goto statement in perl?
Explain chomp?
What does file test operators do in perl?
how to get back up from private character editor which is saved in the format of .udf
In Perl, what is grep function used for?
You want to empty an array. How would you do that?
Explain substr function in perl?
How the interpreter is used in Perl?
How many ways can we express string in Perl?
What are different data types that perl supports. Elaborate on them.
what are the strategies followed for multiple form interaction in cgi programs?
Which has highest precedence in between list and terms? Explain?