in reply to What is Magic ?
Any SV may be magical, that is, it has special features
that a normal SV does not have. These features are stored
in the SV structure in a linked list of "struct magic"'s,
typedef'ed to "MAGIC".An SV is Perl's internal representation of a scalar value. As I understand it, magic allows accesses (reads, writes) from/to variables to call special functions that do special things.
One simple example of this is the %ENV hash: changing values in %ENV change the environment for spawned subprocesses.
Another example of this is the %SIG hash.
Extensions (XS modules) can also add their own magic to variables.
|
|---|