listing all form input names

Ever writing code and need to get a list of the input field names in your html document. I wrote this little perl script to parse out a list of names of the input fields.


#!/usr/bin/perl
open (INFILE, '
while ($line=) {
chomp $line;
my $input = $line;
if ($input =~ /input /
$input =~ /name=\”(\w*)\”/i;
$input = $1;
print “$input\n” ;
}
}

How it works:

Opens a file, reads it in line for line in the while loop. When it finds ”
input name=" and prints that value out after the equal sign. Assumes code is written as compliant html and uses double quote marks after name=

Leave a Reply

You must be logged in to post a comment.