Regardless of the errors that hinder this code from working and which have been duly explained to you, the subroutine in here has a
prototype checking mechanism in place, however, this mechanism is a compile-time mechanism, so to avail of it you got to declare your subroutine and then call it afterwards, if you do it the other way around, i.e you wrote the subroutine call before defining it the prototype checking would simply get ignored and the subroutine would get executed as long as it is free from other errors (logic, syntax, keyword misspelling...).
What this code above is supposed to be doing? , well, the subroutine named "query" has been declared, then when you call it and simultaneously provide arguments, it goes checking if these arguments correspond to the prototype predeclared.
After that each one of the arguments is read into the variables "$name, $type, $comb, @vals" and in the subsequent line @vals contents are modified via the map function and reassigned to @vals again.
The subroutine returns a string of @vals elements enclosed within () and joined together with '=' sign.
Welcome to the Monastery noobie82, familiarize yourself around and make a good use of the Perl documentations...
Excellence is an Endeavor of Persistence.
Chance Favors a Prepared Mind.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.