in reply to
what does this piece of code mean?
Essentially, this code is a little misdirection to encapsulate a Perl script inside a shell script. When it gets to the exec line, the shell re-runs the script file with perl. -x tells perl to search the file for the first occurrence of a #! that also has the word perl, and so fast forwards past all the shell script. A read-through of -S would probably also be informative, and should contain some familiar-looking code.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.