> I need to get all the words in a query (q=___) out of a (URL, I think) > encoded string. > > Example line and my current plan: > > $queryString = > 'pp=20&q=Finance/Banking/Insurance&qField=All&qMatch=any&qSort > =smart&view=1' > > my %querys = $queryString =~ /(\S+)=(\S+)&?/g ; > > #Here I could use a tip on how to split counting the encoding > @words = split ($querys{q}) ; > > I have to do this for millions of lines per month so any tips > to help me > optimize this would be appreciated.
Maybe CGI.pm would help with this? Anyhoo, if what you are trying to do is get the query string item/value pairs into a hash, then the following works: <snip> use strict; use warnings; my $queryString ='pp=20&q=Finance/Banking/Insurance&qField=All&qMatch=any&qSort=smart&view=1 '; # Split the query string on ampersand my @pairs = split(/&/,$queryString); my %queries; my $item; my $value; # Store the item/value pairs in a hash foreach (@pairs) { my ($item,$value) = split(/=/,$_); $queries{$item} = $value; } # Uncomment this block to print the hash #while (($item,$value) = each %queries) #{ # print "$item=$value\n"; #} </snip> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]