Please read this explanation before attempting debugging challenges.
I dont understand, my Perl code is supposed to find all the GET parameters in a URL, but it doesn't...
my %get_vars; if (url_all_get_vars("http://google.com/?aaa=aaa&bbb=bbb&ccc=ccc")){ while (my ($keys,$value) = each(%get_vars)){ print $keys." => ".$value->[$_]."\n" foreach ([email protected]$value-1); } } sub url_all_get_vars { my $url = shift; my @arr; return undef unless $url !~ /\?.*?=.*?$/i; $url =~ /(.*?)\?/; my $cl_url = $1; @arr = $url =~ /[\?|&]([\w|\d]*=[\w|\d]*)&*?/gi; %get_vars = ("$cl_url" => \@arr); return 1; }
Downloadable source code can be found here.