#!/usr/bin/env perl use strict; use warnings; use 5.016; use Time::HiRes 'sleep'; my @cmds; open my $fh,'<','/etc/lirc/lircd.conf'; while (my $line=<$fh>) { $line =~ m{^\s+(b[123]\w+)} or next; push @cmds,$1; } while (@cmds) { my $current = shift @cmds; say "Ready to send $current"; my $ans=<>; if ($ans =~ m{^a}) { unshift @cmds,$current; $current=pop @cmds; unshift @cmds,$current; redo; } elsif ($ans =~ m{^n}) { push @cmds,$current; next; } system('irsend','SEND_START','sonic',$current); sleep 0.8; system('irsend','SEND_STOP','sonic',''); push @cmds,$current; }