GTM::GlobalTie - Ties a Global to a Perl Hash
use GTM::GlobalTie;
my $limit = $ARGV[0] || 1000;
tie %primes, GTM::GlobalTie, "primes";
%primes = ();
$primes{$_} = 1 for(2..$limit);
for my $i (keys %primes) {
for (my $j = $i*$i; $j <= $limit; $j += $i) {
delete $primes{$j};
}
}
my $count = scalar keys %primes;
%primes = ();
print "$count Primes up to $limit\n";
GTM::GlobalTie allows you to access globals through a tied perl hash.
delete $global{xx} does not return the value of ``xx'' for performance reasons so be careful.
the GTM manpage, the GTM::Perl manpage, the GTM::Preprocessor manpage, the GTM::Preprocessor::Cache manpage.
Cac, the Cac::ObjectScript manpage, the Cac::Global manpage, the Cac::Routine manpage, the Cac::Util manpage, the Cac::Bind manpage.
Stefan Traby, <stefan@hello-penguin.com> http://www.hello-penguin.com/gtm-perl
Copyright (C) 2004 by Stefan Traby <stefan@hello-penguin.com> Copyright (C) 2004 by KW-Computer Ges.m.b.H., Graz, Austria
This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL).
In addition to this license
Sanchez Computer Associates, Inc.
40 Valley Stream Parkway
Malvern, PA 19355, USA
has the non-exclusive right to do what ever they want with this code.