Replace
foreach my $s (keys $subscribers) {
with
foreach my $s (keys %$subscribers) { # $subscribers is hash ref
or
foreach my $s (0 .. $#$subscribers) { # $subscribers is array ref
From perldoc
Starting with Perl 5.14, keys can take a scalar EXPR, which must contain a reference to an unblessed hash or array. The argument will be dereferenced automatically. This aspect of keys is considered highly experimental. The exact behaviour may change in a future version of Perl.