in reply to How do I extract data?
Now, if you want the dates for calendar "Calendar_2_test", say, you'd simply access @{ $entries{'Calendar_2_test'} }my %entries; # key=calendar name; value=array(ref) of dates. my $calendar; my @dates; sub finish_pending_entry { if ( defined $calendar ) { $entries{$calendar} = [ @dates ]; } # re-init the state data: $calendar = undef; @dates = (); } while (<>) { chomp; if ( /calendar: (.*)/ ) { finish_pending_entry(); # possibly none, if this is the fi +rst line. $calendar = $1; } else { push @dates, $_; } } finish_pending_entry(); # possibly none, if file was empty.
jdporter
...porque es dificil estar guapo y blanco.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How do I extract data?
by jdporter (Paladin) on Dec 26, 2002 at 23:37 UTC |