>>
It seems like you will inspect each 'd=' part twice...
Yeah, I think your right. To be honest I hadn't really looked at optimizing the code very much, I played around a bit with just setting $i to $j after the inner while loop finishes, but that didn't appear to change the speed one whit ( Probably needs more benchmarks there ) and I was a little uncertain of what exactly I might break by doing that so I took it back out.
>>
you just end up with foo => 'three'
Hrm. Thats a case I hadn't thought of. Hm. Now I can't decide exactly what should happen. I'm favoring the idea of turning it into an array of arrays so your case
o=foo&d=one&d=two&o=foo&d=three would turn in to
$args{o}=[[one,two,three],[three]] only problem is that seems kind of icky, especially the derefencing but I like the idea of being able to call a certain option multiple times.
>>
Personally, I would write the final assignment as:
Well, I considered that idea but my mind rebelled against the idea of having to write
$arg{foo}->[0] every single time I wanted to access a variable. I'm thinking I'll just leave it how it is at the moment, operating under the assumption that most options will only accept one scalar and if a certain option needs multiple values or can accept them then it will check.
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.