Get help on this challenge

Debugging8


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 (0..@$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.


You must be logged in to play.



Challenge by clone4.