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
How do I send e-mail from a Perl/CGI program on a Unix system?
Explain returning values from subroutines?
How to check the status of airplane mode (enable/disable) in perl for Android mobile?
Explain goto label?
What does `new $cur->{LINK}' do? (Assume the current package has no new() function of its own.)
what is Perl one liner?
You want to download the contents of a url with perl. How would you do that?
What are some of the key features of objects in perl?
What's the difference between /^Foo/s and /^Foo/?
Perl uses single or double quotes to surround a zero or more characters. Are the single(' ') or double quotes (" ") identical?
Is there any way to add two arrays together?
What does undef function in perl?
What is a chomp() function in perl?
There are some duplicate entries in an array and you want to remove them. How would you do that?
What is the usage of -i and 0s options?