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 to find a substring in a string without using substr built in functions, and print the substring found
How do you turn on the perl warnings?
How are parameters passed to subroutines in perl?
How can the user execute a long command repeatedly without typing it again and again?
What is -> symbol in perl?
What are the features of perl language?
Define print() function in perl?
What are the advantages and disadvantages of perl language?
Explain perl. What are the advantages of programming in perl?
How to prevent file truncation in perl?
How to check the status of airplane mode (enable/disable) in perl for Android mobile?
Write a program to show the process of spawning a child process