in reply to Subtraction code needed
I'm guessing you are just looking for a way to decrement, and show remaining count.
To do this, re-write your "for" loop like this:
my $crew_count = 3; # Hard-code, or read from another file. foreach (@lines) { chomp; my ($VcrewName, $VposDesired) = split(":"); $VcrewName = "" if !defined($VcrewName); $VposDesired = "" if !defined($VposDesired); my $format = " %-14s %-14s\n"; printf ($format, $VcrewName, $VposDesired); $crew_count --; # Decrement the count } print "Total Road Crews Needed: $crew_count\n"
"I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
-- Dr. Cox, Scrubs
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Subtraction code needed
by PilotinControl (Pilgrim) on Apr 16, 2013 at 12:39 UTC |