I am having some problems dealing with a colon delimited list inside a cgi script. My lists will not show up correctly inside a hidden() input within the browser. Here is a snippet:
defined $param{selected} ? ( $param{selected} .= ":$file" ) : ( $param{selected} = $file ); join ( "", map { hidden ( -name => $_, -default => $param{$_}, ) } keys %param )
Within the script, hidden() seems to forget everything after and including the first :. If I change the hidden() to Dumper, the correct stuff is displayed in the browser window, showing that $file is properly defined. Running the script from the comamnd line also returns the bad results so it isn't specifically a browser problem. What is strange is that if I run:
perl -le 'use CGI qw/ :standard /; print hidden( -name => "foo", -defa +ult => "foo:bar" )'
hidden() seems to do the right thing.

Is there something I am missing in this snippet? Is there a better way to pass a list within cgi arguments?

Thanks in advance.

In reply to :-delimited lists in CGI parameters by narse

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.