Home
81.
I want to create an array of arrays. Can i ?

You can’t do that. Well, not right now. To create arrays of arrays, or arrays of hashes, or any kind of nested data structures, you need to use references.

82.
Why, when you delete an element from an array using delete, does it just undef the element? Why doesn't it delete it and reconstruct the array? Delete means delete, doesn't it?

Not necessarily. Array elements are indexed by number, and the relationship between an element and its index might be important. By deleting an element, you’d end up renumbering all the elements in the farther down in the array, which might not be what you want to do. The delete function does the safe thing and just adds an undef placeholder (except if the element to be deleted is the last element, in which case it’s considered safe to remove it). You can always reconstruct the array if you really want those elements deleted.

83.
How do I search an array for a specific element?

One way would be to iterate over the array using a foreach or while loop, and test each element of that array in turn. Perl also has a function called grep (after the Unix search command) which will do this for you

84.
Define the differences between lists and arrays.

A list is simply a collection of scalar elements. An array is an ordered list indexed by position.

85.
What's the rule for converting a list into a scalar?

There is no rule for converting a list into a scalar. You can't even convert a list into a scalar. Lists behave differently in a scalar context depending on how you use them.

86.
What is %ENV used for? Why is it useful?

The %ENV hash holds the variable names and values for the script’s environment. On Unix and Windows, the values in this hash can be useful for finding out information about the system environment (or for changing it and passing it on to other processes). On the Mac %ENV doesn’t serve any useful purpose.

87.
What’s the difference between using system and backquotes?

The system command runs some other program or script from inside your Perl script and sends the output to the standard output. Backquotes also run an external program, but they capture the input to a scalar or list value (depending on context).

88.
Why would you want to use multiple processes in your Perl script?

Multiple processes are useful for portioning different parts of your script that might need to be run simultaneously, or for splitting up the work your script needs to do.

89.
What does fork do?

The fork function creates a new process, a clone of the original process. Both the new processes continue executing the script at the point where the fork occurred.

90.
Can Win32 processes be used interchangeably with fork?

Win32::Process and fork are not interchangeable. The fork function ties very strongly to processes on Unix; Win32::Process is more analogous to a fork followed immediately to an exec.