Greetings:
I'm trying to allocate a working schedule denoted by numerical ranges of 200 units apiece. What I need is a way to display that schedule split up into a number of "chunks" per volunteer, where each volunteer has given me the number of chunks they're willing to do, like so:
$a = 2192; # Starting number # Ben = 5, Scott = 4, Jim = 1, more to be added later for (0..98){ my $b=$a + 200; my $name = $_ % 10 < 5 ? "Ben" : $_ % 10 > 8 ? "Jim" : "Scott"; print "$a-$b\t\t$name", "\n"; $a+=201; }
So far, this does the right thing - but adding each volunteer is a pain, and I see myself hacking great big ugly *unreadable* logic trees into the script. Yuck!
What I'd really like is a hash where I can add, e.g., 'Joe => 3' and have the script allocate all the stuff properly. Doesn't sound too complex, right? Yeah, I do feel like an idiot for not being able to figure this out for myself...
Thanks for any help.
In reply to Fair schedule allocation? by oko1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |