in reply to Updating hash of subroutines
You could add the parameters to the dispatch hash:
use strict; use warnings; my (%frame_lookup_by) = ( 21 => { desc => "S/W Status", value => sub {$_[0]*256 + $_[1]}, }, 33 => { desc => "HK Subcom", value => sub { $_[1] % 16 } , #modulo 16 of w12 }, 117 => { desc => "General Status", value => sub {$_[0]*256 + $_[1] }, }, 129 => { desc => "Sensor Status", value => sub {$_[0]*256 + $_[1] }, }, hash_params => [1, 0], ); print $frame_lookup_by{21}->{value}->(@{$frame_lookup_by{hash_params}} +);
Prints:
256
|
|---|