|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi:
I have a string, which is in the form of a CGI query (x1=y1&x2=y2&...). How can I parse this into a hash? I know it is probably an easy thing to do. Thanking all in advance. ![]() |
|
#2
|
|||
|
|||
|
Ok, it's simple enough
Code:
$refstr = "x1=y1&x2=y2&x3=y3";
%HASHNAME;
foreach $pair (split(/\&/, $refstr)){
local ($name,$value) = split(/=/, $pair, 2);
$HASHNAME{$name} = $value;
}
Simple enough... if I understood what you were asking correctly... ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Perl Parsing Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|