Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 romping around the Monastery: (6)
As of 2015-08-28 23:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (341 votes), past polls