Modifying MediaWiki user preferences at once

Since long time ago, it's possible to change default user preferences in MediaWiki by simply adding a line of code in LocalSettings.php. Example:
$wgDefaultUserOptions['editsection'] = 0;
However, if the wiki is not new, there could be already several users who will have inherited previous default preferences before any change is performed in LocalSettings.php.
In order to solve this, in recent MediaWiki versions there is a maintenance script for changing a user preference value for all users in the wiki.
Nonetheless, in my case, I did not want to change the preference value for all users, but only for those ones belonging to a certain group. Of course, more complex filtering criteria could be devised…
For anyone who might need it, the code (in Perl) I used below:
Subscribe to RSS - Perl