abachus has asked for the wisdom of the Perl Monks concerning the following question:
Hello once again !
Isaac.
The code below as you can see is a simple way to assign a value to $drink after $punter has been evaluated.
if($punter eq 'coffee'){ $drink = 'non alky'; } if($punter eq 'beer'){ $drink = 'alky'; } if($punter eq 'whisky'){ $drink = 'proper alky'; } else { $drink = 'unknown'; }
Now, surely there is a better way to do it, by that i mean with less lines of code, and if possible doing the same in a more efficient way.
I look forward to any answers, thanks,Isaac.
Back to
Seekers of Perl Wisdom