472,798 Members | 1,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,798 software developers and data experts.

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_LENGTH'});
@pairs = split(/\&/, $stuff);

2.
read(STDIN, $stuff, $ENV{'CONTENT_LENGTH'});
@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!
Jul 19 '05 #1
1 1605
lonelyplanet999 wrote:
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_LENGTH'});
@pairs = split(/\&/, $stuff);

2.
read(STDIN, $stuff, $ENV{'CONTENT_LENGTH'});
@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 ?


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

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Carlos Ribeiro | last post by:
Hi all, While writing a small program to help other poster at c.l.py, I found a small inconsistency between the handling of keyword parameters of string.split() and the split() method of...
1
by: jhcorey | last post by:
I don't know where the actual issue is, but hopefully someone can explain. The following displays "5" in FireFox, but "3" in IE: <script type="text/javascript" language="javascript"> var...
5
by: Better but still clumpsy | last post by:
I have the three following scripts. var pat_piece=/(\w{2})-(\w{2,3})/; item=="kpgn9"> var piece=item.split(pat_piece); Netscape is able to split it correctly while IE isn't. What should...
3
by: Davids | last post by:
I noticed this syntax works string myArray = myString.split('.'); instead of string myArray = myString.split("."); I know the split method requires Char but what is really going on here...
2
by: Hai Ly Hoang [MT00KSTN] | last post by:
CString.FormatMessage and CString.Format has the same parameters and they seems to have to outcome. However, they coexist !. There must be some subtle different between they. Can you tell me the...
2
by: Jay | last post by:
So I'm writting this software that talks to an IRC server; and occasionaly IRC servers send back data two lines at a time with lines breaks inside. For my own sanity I had been using the split...
8
by: Ronald S. Cook | last post by:
I notice there are many terms in the .NET Framework like string and String. What's the difference? Which should I use? I also see int and Int32. They are the same? Thanks, Ron
6
by: krishnakant Mane | last post by:
hello, I am strangely confused with a date calculation problem. the point is that I want to calculate difference in two dates in days. there are two aspects to this problem. firstly, I can't get...
9
by: viki1967 | last post by:
Hi all! This new forum its great! :) Congratulations !!! My answer: why this my code not working? Nothing error but not work the difference.... : <html>
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.