bluegroper
Technical User
How do I get perl to accept merely a single character of input from the console, and then move on without waiting for the "Enter" key ?
Such as
This is just a snippet from a larger project, but I hope you can get the idea.
Just need to press y, n or q, to proceed.
TIA's
- BG
Such as
Code:
#!/perl -w
use strict;
use Net::Wake;
my $Input;
print "Wake On Lan\n";
print "\nWake up SlimServer <Y/N/Q> ?";
$Input = <STDIN>; chomp $Input ; $Input = uc($Input);
if ($Input eq "Q") { exit 0; }
if ($Input eq "Y") {
Net::Wake::by_udp(undef,'00:10:DC:A8:5F:84');
}
exit 0;
This is just a snippet from a larger project, but I hope you can get the idea.
Just need to press y, n or q, to proceed.
TIA's
- BG