Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: CGI.pm file uploads in very generic script

by pjf (Curate)
on Nov 14, 2001 at 04:58 UTC ( #125188=note: print w/replies, xml ) Need Help??


in reply to CGI.pm file uploads in very generic script

G'day amelinda,

CGI's append function varies in behaviour depending upon what it's second argument is. If passed a list reference as a second argument, it appends all those values onto the list of values associated with that given parameter. If the second argument is a scalar, then only that scalar is appended. The third and subsequent arguments are silently ignored.

Here's some example code:

$q->append("foo","hello"); # Adds "hello" to foo's list of v +alues. $q->append("foo","hello","world"); # As above, world is ignored. $q->append("foo",["hello","world"]); # appends both hello and world to + foo's values.

Hope that this helps clarify things.

Cheers,
Paul

Replies are listed 'Best First'.
Re: Re: CGI.pm file uploads in very generic script
by amelinda (Friar) on Nov 14, 2001 at 05:06 UTC
    I think I understand what you mean. But I'd like to clarify it just a little further.

    So, if we have:

    $q->param('foo', 'junk'); $q->append('foo', "$something");
    is 'foo' now "junk$something" or is it ["junk", "$something"]?
      The latter. ["junk","$something"];

      If you want to turn that into the first (ie, one big concatenated string), you can do this:

      $q->param("foo",join("",$q->param("foo")));

      Cheers,
      Paul

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://125188]
help
Chatterbox?
[stevieb]: man, I absolutely LOVE driving in the worst winter conditions. In the mountainous roads, there are extremely few (if any) other drivers. I love the challenge. I've been doing extreme off-road my whole life, and as I said, I'm always well...
[stevieb]: ...prepared for even the very worst
Discipulus seems a part of the globe very unfrindly with Kawasaki riders..
[thezip]: My doggies love it when it snows
[perldigious]: As long as you are a good "boy scout" stevieb, more power to you... but I like my Jeep, and don't like the idea of rolling it or crashing it in to anything. :-)
[thezip]: Me, not as much.
[perldigious]: Mine too thezip, especially my German Shepherd. He looks like he is about to die of heat exhaustion all summer, so he goes nuts when winter comes and he can play in the snow.
[stevieb]: my main off-road vehicle nowadays is a strengthened mercedes ML320. I'm very hard on it, but I've never had any real issues at all (I love how small and light it is, and it has a very, very good centre of gravity for how I roll)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (11)
As of 2016-12-06 16:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (112 votes). Check out past polls.