http://qs321.pair.com?node_id=763212


in reply to Spliting on Key/value pairs

You could do something like this:

my $string = '&keyname=value&keyname2=value2'; # eliminate the first ampersand for cleaner output $string =~ s/^&//; foreach ( split /&/, $string ) { printf "Key: %s, Value: %s\n", split /=/; }

I'd also look on CPAN for something that parses URL queries.

-d.