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


Please Help Members By Posting Answers For Below Questions

What is stdin in perl?

542


Show the use of sockets for the server and client side of a conversation?

470


Which feature of perl provides code reusability?

569


Give an example of the -i and 0s option usage.

467


You want to empty an array. How would you do that?

473






What is the difference between single (') and double (") quote in a string in perl?

483


What is qq (double q)operator in perl?

553


How to close a directory in perl?

493


How do you you check the return code of a command in perl?

579


Explain '->' in perl?

502


How to read a file into a hash array?

548


What are the benefits of perl in using it as a web-based application?

493


Does Perl have reference type?

523


In Perl, what is grep function used for?

528


Create a function that is only available inside the scope where it is defined ?

549