During a penetration test, you are tasked with automating the extraction of form field names from a collection of HTML files. Which programming language would be most efficient to employ for writing a script to perform this operation, considering its powerful libraries for parsing HTML and XML?
JavaScript
Python
Ruby
Perl