Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a magical array in Perl?

In the Perl documentation for reverse I find this:

"Note that reversing an array to itself (as in @a = reverse @a ) will preserve non-existent elements whenever possible; i.e., for non-magical arrays or for tied arrays with EXISTS and DELETE methods."

What properties differentiate a magical from a non-magical array?

like image 594
schulwitz Avatar asked May 18 '15 18:05

schulwitz


People also ask

What is a Magical array?

Magic Arrays are special tools that require a number of magic class players in order to activate the effect. They can be created by Magicians, purchased in special locations, obtained in quests, and found in dungeons and ruins.

What is @_ in Perl script?

The @_ variable is an array that contains all the parameters passed into a subroutine. The parentheses around the $string variable are absolutely necessary. They designate that you are assigning variables from an array.

How do I determine the size of an array in Perl?

Note: In Perl arrays, the size of an array is always equal to (maximum_index + 1) i.e. And you can find the maximum index of array by using $#array. So @array and scalar @array is always used to find the size of an array.


1 Answers

Magical variables are those that have special features that a normal variables of that type do not have.

See Magic Variables in perlguts. See also Variable::Magic which lets you "Associate user-defined magic to variables from Perl."

like image 78
Sinan Ünür Avatar answered Oct 03 '22 09:10

Sinan Ünür