At 09:10 PM 05/24/01 +0100, Bill Stennett wrote:
>>>>
Hi All


I'm trying to create a regex to allow me to extract a value from a string composed of name=value pairs seperated by the '&' symbol. The problem I have is that there is no guarantee in which order the name=value pairs will appear - the significance of this being that the final name value pair in the string is NOT followed by the '&' symbol.
<<<<
Do you want a regexp or a solution?

use CGI;
my $q = CGI->new('abc=123&hello=there');
print $q->param('abc');

Or

%h = map { split /=/ } split /&/, 'VAL1=123&VAL2=456&VAL3=788';
print "$_ -> $h{$_}\n" for sort keys %h;





Bill Moseley
mailto:[EMAIL PROTECTED] _______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/activeperl

Reply via email to