in reply to Problem sorting hash & assigning to new hash to send to HTML::Template

I think your hash %bnb has _no_ keys. Try
$template->param( bestNw => $bestNw || [] );
Boris