The third line is:
my $hash = shift || return;
...and clearly you are trying to pass in an array reference - hence can't coerce an array (you passed in) into a hash (what it wants).
Did you even read the description of the subroutine on about line 50?
# Takes a plugin name and config hash and saves it.