in reply to Calendar question
If your question is "how do I flatten the AoA into a single array and convert the undef elements to empty strings?", then just loop through the "week" elements, pushing the days from each week onto a single array; here's a way to do that using "for" and "map":
Having done that, I have to wonder... Why would you want to do that?use strict; use Calendar::Simple; use Data::Dumper qw/Dumper/; my ( $mon, $yr ) = ( localtime )[4,5]; $mon++; $yr+=1900; my @weeks = calendar( $mon, $yr ); my @month; for my $week ( @weeks ) { push @month, map { $_ || "" } @$week; } print Dumper( \@month );
(updated to include a link to the module's CPAN page)
|
|---|