Fontenot, Paul <[EMAIL PROTECTED]> wrote:

: EXAMPLE:
: ========================================
: while (my(@row) = $sth1->fetchrow_array)
: {
:     my ($total) = $row[0];
:     print "Total Scanned:\t $total\n";
: }
: 
: print "Total:\t $total\n";
:
: After searching through the Perl Bookshelf CD, I have found
: that you can declare a global and then use local() to change
: that value for a block of code.

   Yes. It is frowned upon, but it can be done. It is almost
always easier and better without local() or global variables.


: I haven't found how to use a value from within a block of
: code outside that block of code though. Is this possible?

   Yes, though perhaps, not the way you mean. The CGI.pm
module let's you read the value of some of its variables
by using global[1] variables.

    For example, CGI.pm normally allows files to be uploaded.
We can verify this.

use CGI;
my $query = CGI->new();

print $CGI::DISABLE_UPLOADS;

    We can change that variable also.

$CGI::DISABLE_UPLOADS = 1; # Disable uploads

print $CGI::DISABLE_UPLOADS;

    Or we can check it.

my $query = CGI->new();

print $query->p( 'Uploads are disabled' ) if $CGI::DISABLE_UPLOADS;



HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328


[1] In the archives there is a message indicating that
    perl does not have true globals. I'm not certain the
    difference, but for this discussion I use "global"
    as a variable in the symbol table of its package.






-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to