in reply to Track command time

Typically, you'd use an alarm.
local $SIG {ALRM} = sub {die "alarm"}; eval { alarm (5); system "sleep 10"; alarm (0); }; if ($@ && $@ =~ /^alarm/) { say "Command interrupted"; }
See also "perldoc -f alarm" and "man perlipc".