Though he's probably not allowed to use CPAN in his course work, it's too bad. Because if he could, he would be able to use IO::Prompt::Tiny or IO::Prompt::Hooked to simplify the prompting for input. In fact, though it's like calling in the artillery when a fly swatter is needed, ExtUtils::MakeMaker is a core module, and comes with the prompt function.
use ExtUtils::MakeMaker 'prompt';
my $value = prompt "Please enter something.", "asdf";
print "$value\n";
The first argument is what to say to the user. The second argument is what default to assume if the user just hits enter (or if there's no terminal).