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 |
Which guidelines by Perl modules must be followed?
What is the difference between use and require in perl?
Explain the difference between my and local?
what is Perl one liner?
You want to open and read data files with perl. How would you do that?
Explain gmtime() function in perl?
Explain regular expression in perl?
Can we load binary extension dynamically?
How can you call a subroutine and identify a subroutine?
How interpreter is used in perl?
what is CPAN?
When would `local $_' in a function ruin your day?