There are various ways to handle this. If you control the program, you should re-arrange it to accept the defaults when it's not interactive (and IO::Interactive is a good tool for that).
For really quick things, sometimes I just steal prompt from ExtUtils::MakeMaker. It's self contained so you can steal and modify it for your needs:
#!perl
use v5.10;
use ExtUtils::MakeMaker qw(prompt);
my @answers;
push @answers, prompt( "First", "yes" );
push @answers, prompt( "Second", "yes" );
push @answers, prompt( "Third", "yes" );
say "Done! Got @answers";
If I run this normally, I have to answer the prompts:
$ perl yes.pl
First [yes] cat
Second [yes] dog
Third [yes] bird
Done! Got cat dog bird
But ExtUtils::MakeMaker has an environment variable to accept the defaults:
$ PERL_MM_USE_DEFAULT=1 perl yes.pl
First [yes] yes
Second [yes] yes
Third [yes] yes
Done! Got yes yes yes
From here to the end of the answer are just shell techniques to supply input. There's no special Perl stuff going on. And, some things may not work depending on what the program itself is trying to do.
I can also feed it /dev/null, in which case it realizes the program is not running interactively, and it accepts the defaults for me:
$ perl yes.pl < /dev/null
First [yes] yes
Second [yes] yes
Third [yes] yes
Done! Got yes yes yes
But, I can also feed it a multiline string for input:
$ perl yes.pl <<HERE
yes
yes
no
HERE
First [yes] Second [yes] Third [yes] Done! Got yes yes no
That might be too much for your file, so you can echo a string with embedded lines:
$ perl yes.pl < <( echo -e "yes\nno\nhello")
First [yes] Second [yes] Third [yes] Done! Got yes no hello
$ perl yes.pl < <( echo $'yes\nno\nhello')
First [yes] Second [yes] Third [yes] Done! Got yes no hello
Or get the input from a file:
$ perl yes.pl < input.txt
First [yes] Second [yes] Third [yes] Done! Got heck yeah no way yep
And, stolen from simbabque's answer, since I'm going for a list of techniques:
$ printf "yes\nyes\nno\n...\nyes\n" | yes.pl