strange - get(url) changes local variable

Z

zorro

Hello,

I've only been doing perl for two weeks so this might be a newbie
problem, yet this error still is kind of strange. I'm fetching an xml
file with get(), and it changes the value of a local variable named
$url - could it be that $url is a reserved word?


$url = $FORM{'someUrl'}; // just some url

if($FORM{'shopInfoUrl'}) // fetching xml file
{
use Socket;
my $xml="";

# when i do a trace here, $url is what it should be

$xml = &get($FORM{'shopInfoUrl'});

# when i do a trace here, $url now equals the fetched url
# while $FORM{'someUrl'} still has the original value

}

Any idea what's going on?
 
D

DJ Stunks

zorro said:
Hello,

I've only been doing perl for two weeks so this might be a newbie
problem, yet this error still is kind of strange. I'm fetching an xml
file with get(), and it changes the value of a local variable named
$url - could it be that $url is a reserved word?


$url = $FORM{'someUrl'}; // just some url

if($FORM{'shopInfoUrl'}) // fetching xml file
{
use Socket;
my $xml="";

# when i do a trace here, $url is what it should be

$xml = &get($FORM{'shopInfoUrl'});

# when i do a trace here, $url now equals the fetched url
# while $FORM{'someUrl'} still has the original value

}

Any idea what's going on?

it is impossible to tell from your snippet.

please follow the posting guidelines for this group and post a _short_
but _complete_ script (including use strict and use warnings) which
demonstrates your issue and someone will be glad to help you debug it.
remember to copy and paste this script in - don't just write it on the
fly.

-jp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top