You can't do as you asked, but you can mimic the behaviour with a subroutine:
sub input { chomp( my $input = <STDIN> ); exit if $input eq "exit"; return $input; }
With that sub defined, just use my $var = input(); instead of my $var = <STDIN>;
In reply to Re: Entering EXIT at any prompt
by FunkyMonk
in thread Entering EXIT at any prompt
by trenchwar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |