[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] Fwd: iCal::Parser - or how to iterate through this hash?



print "SUMMARY: ";
# http://search.cpan.org/~rfrankel/iCal-Parser-1.11/lib/iCal/Parser.pm
print $hash->{events}->{2006}->{2}->{6}->{'uuid:1139273884656'}->{SUMMARY} . "\n";
# Don't know what to do with this stuff here, probably need to READ more. =)

Not suggesting this is a good idea, but... something like this? Eeek, I feel so dirty... -grin-

$ cat j.pl

$hash->{events}->{2006}->{2}->{6}->{'uuid:1139273884656'}->{SUMMARY} = "test1";
$hash->{events}->{2006}->{2}->{7}->{'uuid:1139273884656'}->{SUMMARY} = "test2";
$hash->{events}->{2006}->{3}->{7}->{'uuid:1139273884656'}->{SUMMARY} = "test3";

my $events = $hash->{events};
my ($y, $m, $d, $uuid, $summary);
foreach $y (keys %{$events}) {
 foreach $m (keys %{$events->{$y}}) {
   foreach $d (keys %{$events->{$y}->{$m}}) {
     foreach $uuid (keys %{$events->{$y}->{$m}->{$d}}) {
       $summary = $events->{$y}->{$m}->{$d}->{$uuid}->{SUMMARY};
       printf("%04d-%02d-%02d %s %s\n", $y, $m, $d, $uuid, $summary);
     }
   }
 }
}

$ perl j.pl
2006-03-07 uuid:1139273884656 test3
2006-02-06 uuid:1139273884656 test1
2006-02-07 uuid:1139273884656 test2


Sorry about that,  -laugh-

j
ewwwww