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
Explain tk?
What are the arguements we normally use for perl interpreter?
What is goto statement in perl?
What are perl variables?
How to get help for perl?
Write a program to concatenate the $firststring and $secondstring and result of these strings should be separated by a single space.
What are stdin, stdout and stderr?
Is perl a case sensitive language?
How many types of primary data structures in Perl and what do they mean?
Differentiate between use and require, my and local, for and foreach and exec and system
What are the different instances used in cgi overhead?
Explain the difference between "my" and "local" variable scope declarations. ?
How to access parameters passed to a subroutine in perl?
Explain join function in perl?
Explain the various characteristics of perl.