in reply to Why does my subroutine not receive the scalar parameter as $_?
In addition, you have trouble brewing once you fix that problem. You are defining your $months hash as a hash reference instead of a hash, and that breaks in the loop that follows. The relevant part of you code (with corrections) is:
my %months = ( ## Change $ to % and { to ( --- no reason t +o use a reference here. 'JAN' => '31', 'FEB' => "$feb", 'MAR' => '31', 'APR' => '30', 'MAY' => '31', 'JUN' => '30', 'JUL' => '31', 'AUG' => '31', 'SEP' => '30', 'OCT' => '31', 'NOV' => '30', 'DEC' => '31', ); ## Changed { to ) my @month_keys = (keys %months); my $tot_days = $dd; for (my $i = 0; $month_keys[$i] ne $mon; $i++) { # Added my
Also, in future, it is better to ask your questions in the Seeker of Perl Wisdom section rather than here in the Q&A section. This is reserved for generic Q&A's, rather than specific questions like your.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Answer: Why does my subroutine not receive the scalar parameter as $_?
by belg4mit (Prior) on Aug 26, 2002 at 23:41 UTC |