Program Code:
#!/Perl/bin/perl
print("Enter the question you want to ask \n");
$input=<STDIN>;
if($input =~ /please/)
{
print("You are good in nature.My name is Abhishek \n");
}
else
{
print("First use word please");
}
Output:
Program Code:
#!/Perl/bin/perl
print("We are searching a pattern which ends with letter a in word pragma\n");
print("Patterns we found in this word are\n");
while("pragma" =~ /.a/g)
{
$match=$&;
print("$match \n");
}
Output:
Program Code:
#!/Perl/bin/perl
$string="hi this is abhishek\n my name is abhishek";
print("We are searching a pattern with comparison in multiple lines\n");
print("Patterns we found in this word are\n");
$string =~ /^hi/m;
$match=$&;
print("$match \n");
Output:
Program Code:
#!/Perl/bin/perl
print("Enter the sentences \n");
$input=<STDIN>;
while($input ne " ")
{
chop($input);
@words=split(/ +/,$input);
$count+=@words;
print("Total number of words till now are $count \n");
$input=<STDIN>;
}
Output:
#!/Perl/bin/perl
print("Enter the question you want to ask \n");
$input=<STDIN>;
if($input =~ /please/)
{
print("You are good in nature.My name is Abhishek \n");
}
else
{
print("First use word please");
}
Output:
Program Code:
#!/Perl/bin/perl
print("We are searching a pattern which ends with letter a in word pragma\n");
print("Patterns we found in this word are\n");
while("pragma" =~ /.a/g)
{
$match=$&;
print("$match \n");
}
Program Code:
#!/Perl/bin/perl
$string="hi this is abhishek\n my name is abhishek";
print("We are searching a pattern with comparison in multiple lines\n");
print("Patterns we found in this word are\n");
$string =~ /^hi/m;
$match=$&;
print("$match \n");
Output:
Program Code:
#!/Perl/bin/perl
print("Enter the sentences \n");
$input=<STDIN>;
while($input ne " ")
{
chop($input);
@words=split(/ +/,$input);
$count+=@words;
print("Total number of words till now are $count \n");
$input=<STDIN>;
}
0 comments:
Post a Comment