Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^3: Calendar / Scheduler in Perl

by blue_cowdawg (Monsignor)
on Apr 25, 2013 at 17:40 UTC ( #1030710=note: print w/replies, xml ) Need Help??

in reply to Re^2: Calendar / Scheduler in Perl
in thread Calendar / Scheduler in Perl

This should give you a starting point.

#!/usr/bin/perl -w use strict; my $OldIFS = $/; $/="**"; my ($taskList,$assigns)=<DATA>; chomp($taskList); $/=$OldIFS; my @tasks=split(/[\n]/,$taskList); my $timeline={}; foreach my $task(@tasks){ $timeline->{$task}=[]; } my @resourceList=split(/[\n]+/,$assigns); foreach my $assign(@resourceList){ my($resource,$theTasks)=split(/[\=]/,$assign); next unless $resource; # Deal with empty lines $resource =~ s/\s+$//; $theTasks =~ s/^\s+//; $theTasks =~ s/\s+$//; my @tasks=split(/[\s]+/,$theTasks); foreach my $task(@tasks){ push @{$timeline->{$task}},$resource; } } foreach my $key(sort keys %$timeline){ printf "%s\t%s\n",$key,join(",",@{$timeline->{$key}}); } exit(0); __END__ Task1 Task2 Task3 Task4 Task5 ** Joe Blow = Task1 Sally Brown = Task1 Task2 Jane Doe = Task3 Task5 Sid Down = Task2 Task4 Hoof Hearted = Task1 Task5

Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030710]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2017-04-25 05:39 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (449 votes). Check out past polls.