--- tom poe <[EMAIL PROTECTED]> wrote:
> Hi, Zentara:  I fiddled [far more than one would expect], and used the 
> recently posted write to file format above, and it works with the top line, 
> "#! /usr/bin/perl -w".  But, if I add "use strict;" at the top of the script, 
> I can't compile:
> tompoe@aether:~/perlStuff > createpng
> Global symbol "$im" requires explicit package name at ./createpng line 5.
> Global symbol "$red" requires explicit package name at ./createpng line 7.
> Global symbol "$im" requires explicit package name at ./createpng line 7.
> Global symbol "$blue" requires explicit package name at ./createpng line 8.
> Global symbol "$im" requires explicit package name at ./createpng line 8.
> Global symbol "$im" requires explicit package name at ./createpng line 11.
> Global symbol "$blue" requires explicit package name at ./createpng line 11.
> Global symbol "$im" requires explicit package name at ./createpng line 13.
> Global symbol "$red" requires explicit package name at ./createpng line 13.
> Global symbol "$im" requires explicit package name at ./createpng line 19.
> Execution of ./createpng aborted due to compilation errors.
> 
> So, since we're here, do you understand what the message is?  A required 
> explicit package name?  I'm lost.  Thanks, Tom

Tom,

What that means is that the variables (global symbols) need to be declared prior to 
their being
used.  This is a Good Thing because this helps to alleviate typos in variable names.  
The first
time you use one of those variables in a given scope, preface the use with 'my'.  For 
example:

    my $im = new GD::Image(100,100);

In large applications, typing $recieved instead of $received is very annoying and 
tough to spot. 
Using 'strict' will prevent this.  See 'perldoc strict' for more examples.

You can read http://www.perlmonks.org/index.pl?node_id=108286 for a more thorough 
explanation of
this (and it includes other programming tips as well).

Cheers,
Curtis "Ovid" Poe

=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to