Well, the following lines at the start and end of your subroutine would do:
my ($in, @in, %in);
# stuff here
return \%in; # or %in, as you prefer
You'll get back either a reference to a hash of keys and values or a copied list made from the hash, depending on if you return a reference or the hash.
You could also declare %in as a global variable at the top of this script with use vars qw( %in );. You can keep the internal my declaration of $in and @in, as they don't appear to be used outside your subroutine.
Of course, CGI.pm has been included in the standard distribution of Perl since 5.004. If you're regularly working on servers with older installations than that, it's time for their owners to upgrade. The current release is two minor versions higher, with lots of bug and security and feature fixes I'm sure you already know about. :)
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.