Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

dwm042's scratchpad

by dwm042 (Priest)
on Oct 26, 2007 at 20:07 UTC ( #647486=scratchpad: print w/ replies, xml ) Need Help??

my @months = qw{ May Jun }; my @end_of_month = ( 31, 30 ); my $start_day = 16; my $end_day = 3; my $end_month = $months[1]; my $incr = date_initialize( $start_day, \@months, \@end_of_month); for ( my ($day, $month) = ( 16, "May") ; $day != $end_day or $month n +e $end_month ; ( $day, $month ) = $incr->() ) { # # do stuff # } # # set up incrementer. This function returns a reference to an indexing + function. # sub date_initialize { my $day = shift; my $monthref = shift; my $endmonthref = shift; my $month_index = 0; return sub { $day++; if ( $day > $$endmonthref[$month_index] ) { $day = 1; $month_index++; } return ( $day, $$monthref[$month_index] ); } }
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2014-09-21 23:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls