HI
Try this
#!/bin/perl
use strict;
use diagnostics;
print "\t Enter Month of a year \n";
my $month = (<STDIN>);
chomp($month);
my %days_month = (
January => 31,
February => 28,
March => 31
);
print "\t Number of Days in month of $month is $days_month{$month} \n ";
Regards
Anand
joseph tacuyan <[EMAIL PROTECTED]> wrote:
Hi List,
I'm learning learning perl thru a book, as part of my exercises i tried to run
this code:
#!/bin/perl
use strict;
use diagnostics;
print "\t Enter Month of a year \n";
my $month = ();
my %days_month = (
January => 31,
February => 28,
March => 31
);
print "\t Number of Days in month of $month is $days_month{$month} \n ";
i got an error of uninitialized ...blah...blah ..blah...
But if i declare the value of $month in hard code it runs without glitch but i
like to have an input from keyboard. plz enlighten.
/joseph
perl convert.
---------------------------------
Blab-away for as little as 1ยข/min. Make PC-to-Phone Calls using Yahoo!
Messenger with Voice.
---------------------------------
Jiyo cricket on Yahoo! India cricket
Yahoo! Messenger Mobile Stay in touch with your buddies all the time.