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 are prefix dereferencer?
Differentiate between arrays and list in perl.
What is grep used for in perl?
What is perl dbi?
How many types of primary data structures in Perl and what do they mean?
Which has the highest precedence, List or Terms? Explain?
What are perl variables?
Explain lists and ivalue?
What is perl I used for?
sort a word "system" in perl/shell without using built in functions output should be emssty
Explain goto label, goto name, and goto expr?
How to determine strings length in perl?