I can get the disply to work, but i can not figure outhow to convert a number from user input to apply to an item in my array. And how to validate that the number entered matches the number of items in the array.

Hi sateal8,
Below my comments is the modified script of yours that works, just as you wanted it. Before then please check the comments.

Thank you for the response but we havent covered hashes yet.

You may read it up.

... i cant figure out how to match the number input to the array index

There is no array defined as @array in your script, so why use " if( $answer = $array[$index] ){...} ", and what is $index?. Even your varaiable $answer was not defined. Please, use

use warnings;
use strict;

in your code. It will save you alot of troubles. Only use "use diagnostics;" for verbose information on errors.

Am sure you would have covered if/elsif/else and while loop. Simply use those to solve this problem.

We know that in Perl and most programming lang. array start from 0 not 1, but our script will show on the screen from 1, thanks to the variable $show_choices or $c as you called it. So, to get the array index inputted by the user, we get put the user's input into out array as array index and remove 1 from it since array really starts from 0. Then we can get the true position of our array index. That is the reason for:

... $comedy[$answer-1] ...

In your code, this:

...
$cshow = " [$c] $cshow"; ## changes the array @comedy
...

changes the array @comedy, that each array index now have [number], in front of it. so it becomes another work altogether to display only the initial text of the array. So, to avoid that use this:

print " [$c] $cshow\n";

instead, that is just display the new text without reassigning it to replace the original array index.

Please, always, Use <STDIN>, not just <>, except you really know what you want and what you are doing. :)!

lastly, Please always use meaningful variable names. It will help you understand what the variable is, when you come back to the script 6 months from now.

Below is the your revised copy of code, that I modified and it works fine.