- or download this
if (-t STDIN && -t STDOUT) {
print "Enter an integer: ";
}
- or download this
my $count = <>;
- or download this
sub is_interactive {
return -t *ARGV && -t *STDOUT;
...
if (is_interactive()) {
print $PROMPT;
}
- or download this
-t *ARGV
- or download this
sub is_interactive {
# Not interactive if output is not to terminal...
...
if (is_interactive()) {
print $PROMPT;
}
- or download this
use IO::Interactive qw( is_interactive );
...
if (is_interactive()) {
print $PROMPT;
}
- or download this
use IO::Interactive qw( interactive );
# and later...
print {interactive} $PROMPT;