Try pattern matching for the following:
1) 10.111.23.11
2) /root/abc/cde/fgg/ac.xml --> Get file name without
extention.
3) /root/abc/ac.xml/fgg/ac.xml --> Get file name without
extention.
4) What does "DIE" meant in PERL?
5) chomp
6) "This is saturday" --> Print the weekday number.
7) 11-2-2009 --> Print the name of the month.
8) Reverse the string without using func in C.
Answer Posted / kiruthikau
Try the following code for getting weekday number.
[code]
use strict;
use warnings;
my %days=("Sunday"=>1,
"Monday"=>2,
"Tuesday"=>3,
"Wednesday"=>4,
"Thursday"=>5,
"Friday"=>6,
"Saturday"=>7,);
my $str="This is Saturday";
my @day=split(' ',$str);
print "\tWeekday Number of $day[-1] is:",$days{$day[-1]};
[/code]
Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is stdin in perl?
Show the use of sockets for the server and client side of a conversation?
Which feature of perl provides code reusability?
Give an example of the -i and 0s option usage.
You want to empty an array. How would you do that?
What is the difference between single (') and double (") quote in a string in perl?
What is qq (double q)operator in perl?
How to close a directory in perl?
How do you you check the return code of a command in perl?
Explain '->' in perl?
How to read a file into a hash array?
What are the benefits of perl in using it as a web-based application?
Does Perl have reference type?
In Perl, what is grep function used for?
Create a function that is only available inside the scope where it is defined ?