Hi,
I'm trying to convert a URL, like this;
http%3A%2F%2Fwww.domain.com%2FEconomics%2FA_monopoly_can_control_price_or_output_but_not_both_L1624%2F
I'm using this global;
my $in = $_[0];
return unless defined $in;
for my $str (ref $in eq 'ARRAY' ? @$in : $in) {
$str =~ tr/+/ /; # pluses become spaces
$str =~ s/%([0-9a-fA-F]{2})/chr(hex($1))/ge;
}
print "FOO: $in";
return \$in;
}
Can anyone see whats going wrong? Even when passing it via this global, it doesn't "convert" it into a valid URL (i.e http://www.domain.com/....).
I've made sure that its being escaped (with \$in) .. but that doesn't seem to be having any affect :/
TIA
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
I'm trying to convert a URL, like this;
http%3A%2F%2Fwww.domain.com%2FEconomics%2FA_monopoly_can_control_price_or_output_but_not_both_L1624%2F
I'm using this global;
Code:
sub { my $in = $_[0];
return unless defined $in;
for my $str (ref $in eq 'ARRAY' ? @$in : $in) {
$str =~ tr/+/ /; # pluses become spaces
$str =~ s/%([0-9a-fA-F]{2})/chr(hex($1))/ge;
}
print "FOO: $in";
return \$in;
}
Can anyone see whats going wrong? Even when passing it via this global, it doesn't "convert" it into a valid URL (i.e http://www.domain.com/....).
I've made sure that its being escaped (with \$in) .. but that doesn't seem to be having any affect :/
TIA
Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!