why explicit package name required?

G

Geoff Cox

Hello,

I get the warning that the global symbol (re $picnumber on last line
below) requires explicit package name - I am not clear why. If I
remove the # from the first line that value of $picnumber is used on
the last line shown below.

What am I missing here?

Geoff

# my $picnumber = 20;

find sub {

if (-d $_) {

if ($_ eq "location") {
$picnumber = 20;
}

return;

}

line which uses $picnumber
 
A

Anno Siegel

Geoff Cox said:
Hello,

I get the warning that the global symbol (re $picnumber on last line
below) requires explicit package name - I am not clear why. If I
remove the # from the first line that value of $picnumber is used on
the last line shown below.

What am I missing here?

Geoff

# my $picnumber = 20;

find sub {

if (-d $_) {

if ($_ eq "location") {
$picnumber = 20;
}

return;

}

line which uses $picnumber

perldoc -f my. Also see "strict vars" in perldoc strict.

Anno
 

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,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top