if (defined $ENV{DEBUG_TTY}) { my $tty = $ENV{DEBUG_TTY}; open my $out,'>',$tty; open my $in,'<',$tty; my $term = Term::ReadLine->new('Simple Perl calc',$in,$out); } else { ...; }