Difference in split funciton parameters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lonelyplanet999

    Difference in split funciton parameters

    Hi,

    I'm a newbie of perl language and I would like to ask the differences
    in below pieces of code:

    1.
    read(STDIN, $stuff, $ENV{'CONTENT_L ENGTH'});
    @pairs = split(/\&/, $stuff);

    2.
    read(STDIN, $stuff, $ENV{'CONTENT_L ENGTH'});
    @pairs = split(/&/, $stuff);

    Do they both get a blob of data with length specified by the
    CONTENT_LENGTH environment variable then split the name=value pairs
    separated by '&' characters ?

    Tks!
  • Gunnar Hjalmarsson

    #2
    Re: Difference in split funciton parameters

    lonelyplanet999 wrote:[color=blue]
    > I'm a newbie of perl language and I would like to ask the
    > differences in below pieces of code:
    >
    > 1.
    > read(STDIN, $stuff, $ENV{'CONTENT_L ENGTH'});
    > @pairs = split(/\&/, $stuff);
    >
    > 2.
    > read(STDIN, $stuff, $ENV{'CONTENT_L ENGTH'});
    > @pairs = split(/&/, $stuff);
    >
    > Do they both get a blob of data with length specified by the
    > CONTENT_LENGTH environment variable then split the name=value pairs
    > separated by '&' characters ?[/color]

    Yes.

    You know that there is a standard module that can be used for parsing
    form data, right?

    use CGI;

    See http://stein.cshl.org/WWW/software/CGI/

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl

    Comment

    Working...