PilotinControl has asked for the wisdom of the Perl Monks concerning the following question:
Good Afternoon Monks!
I am trying to accomplish the following in a more automated fashion. My code is below and here is the question: Based on if the truck is filled with which ever commodity I would like the second field to be automatically filled in with either being loaded or emptied.
print "==============\n\n"; print "| COMMODITY: |\n\n"; print "==============\n\n"; my $cmmdty = <STDIN>; $cmmdty = <STDIN> until defined $cmmdty; chomp $cmmdty; cls(); print "====================\n\n"; print "| LOADED OR EMPTY: |\n\n"; print "====================\n\n"; my $lore = <STDIN>; $lore = <STDIN> until defined $lore; chomp $lore; cls();
I know I need an if statement like below:
if ($cmmdty eq 'NONE') { print "E"\n"; } elsif { print "L"\n; }
Am I on the right track? I just need to be guided on to where to put the code to get the desired output I am looking for. Thanks in advance!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Auto Fill - LAZY question!
by ww (Archbishop) on May 15, 2015 at 20:24 UTC | |
by PilotinControl (Pilgrim) on May 15, 2015 at 20:30 UTC | |
|
Re: Auto Fill
by NetWallah (Canon) on May 15, 2015 at 20:47 UTC | |
by PilotinControl (Pilgrim) on May 15, 2015 at 21:03 UTC | |
by NetWallah (Canon) on May 15, 2015 at 22:07 UTC | |
by PilotinControl (Pilgrim) on May 15, 2015 at 22:15 UTC | |
|
Re: Auto Fill
by golux (Chaplain) on May 16, 2015 at 14:36 UTC | |
|
Re: Auto Fill - FIXED
by PilotinControl (Pilgrim) on May 15, 2015 at 23:38 UTC | |
by kcott (Archbishop) on May 16, 2015 at 05:36 UTC | |
by NetWallah (Canon) on May 16, 2015 at 00:44 UTC | |
by PilotinControl (Pilgrim) on May 16, 2015 at 01:20 UTC |