in reply to Easier way to cram Date::Calc's Calendar into a 2-D array
Update: Added unshift and push to make sure first and last rows have seven days.#! /usr/bin/perl use strict ; use warnings ; $|++ ; use Date::Calc qw( Calendar ) ; use Data::Dumper ; my $cal = Calendar( 2002, 8 ) ; my @arr = map { [ split ] } grep { /^[\d\s]+$/ } split /\n/, $cal ; unshift @{$arr[ 0]}, undef until @{$arr[ 0]} == 7 ; push @{$arr[-1]}, undef until @{$arr[-1]} == 7 ; print Dumper( \@arr ) ; __END__
Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
--Friedrich Nietzsche
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Easier way to cram Date::Calc's Calendar into a 2-D array
by oylee (Pilgrim) on Aug 07, 2002 at 19:00 UTC |