in reply to Calendar question

The OP code prints a nice, simple calendar based on an array of arrays returned by Calendar::Simple->calendar(). There's one top-level array element for each week in the month, and each one holds a reference to an array of date numbers in that week (or undef for weekdays before the first and after the last day of the month).

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":

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 );
Having done that, I have to wonder... Why would you want to do that?

(updated to include a link to the module's CPAN page)