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 perl unshift array function?
What are scalar data and scalar variables?
What is hash?
What does last statement do in perl?
Perl uses single or double quotes to surround a zero or more characters. Are the single(' ') or double quotes (" ") identical?
List the data types that Perl can handle?
Explain '->' in perl?
Define say() function in perl?
Write syntax to add two arrays together in perl?
How the interpreter is used in Perl?
what are the two ways to get private values inside a subroutine or block?
What is automatic error handling in perl?
Explain the difference between declarations of 'my' and 'local' variable scope in perl?
what are steps to do to lock the sony ericsson mobile with password?
How can you use Perl warnings and what is the importance to use them?