How do I get width and height of my terminal with ioctl?
问题 What do I have to change to make this work? #!/usr/bin/perl use 5.012; use warnings; require "/usr/lib/perl5/vendor_perl/5.12.1/x86_64-linux-thread-multi/sys/ioctl.ph"; my ($rows, $cols, $xpix, $ypix); my $winsize = "\0" x 8; my $TIOCGWINSZ = 0x40087468; # should be require sys/ioctl.pl if (ioctl(STDOUT, $TIOCGWINSZ, $winsize)) { ($rows, $cols, $xpix, $ypix) = unpack('S4', $winsize); } else { say "something didn't work" and exit; } Inspired by tchrist's answer in From column to row. 回答1: This