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 |
How do find the length of an array?
Is there any way to add two arrays together?
what is the meaning of rigging?
What happens when you return a reference to a private variable?
“Perl regular expressions match the longest string possible”. What is the name of this match?
In Perl, there are some arguments that are used frequently. What are that arguments and what do they mean?
What are the various uses of perl?
Remove the duplicate data from @array=(“perl”,”php”,”perl”,”asp”)
Where do we require ‘chomp’ and what does it mean?
Explain string comparison operators in perl.
what is perl language?
Name an instance where you used a CPAN module?