I have a perl script that is writing to stdout which is a tty. Is there a way to determine how many spaces to a tab on that tty?
You want the 'it' capability from terminfo.
use Term::Terminfo;
my $ti = Term::Terminfo->new;
$tabsize = $ti->getnum( "it" );