[Mastering-perl] Perl Contexts & Symbol Tables and Typeglobs

Florian Merges fmerges at cpan.org
Tue Jan 2 15:25:45 EST 2007


Hi,


Ch. Perl Contexts
=============

Section: Void, Scalar, and List -> Void context
-------------------------------------------------------------------

which most people hear about onyl because ==> only


Section: Void, Scalar, and List -> Scalar context
----------------------------------------------------------------------

Perl's localtime function does different things ==> Add q[:] ?

Some of you probably still don't beleive me ==> believe

Since there are six elements (5, 6, 7, 8, 9, 10), ==> (6, 7, 8, 9, 10,
11)


Section: Idioms -> Counting things
--------------------------------------------------

my $count = () = m/.../; ==> my $count = () = m/.../g;

it allocates extra memory for the hash assuming that ifI add ==> if I


Ch. Symbol Tables and Typeglobs
=========================

Section: Package and lexical variables
--------------------------------------------------------

$n and $global should be declared with 'our'


Section: Package and lexical variables -> Full package specification
--------------------------------------------------------------------------------------------------

Last example output should be:

In the naked block, our $global is --> I'm the global version
In lexical, my $global is --> I'm in the lexical version
The package version is still --> I'm the global version
In lexical(): I'm the global version

Section: The symbol table
--------------------------------------

The first code example, instead of using the 'foreach' idiom, I would
suggest:

print join "\n", keys %main::;

Section: The symbol table -> Naming anonymous subroutines
-----------------------------------------------------------------------------------------

..., and then using that function to created two anonymous subroutines.

==> what?


Kind regards,

Florian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://five.pairlist.net/pipermail/mastering-perl/attachments/20070102/80e43ab0/attachment.htm


More information about the Mastering-perl mailing list