From: Tim Hammerquist Date: 2005-12-09T06:32:36+09:00 Subject: Re: They say I write Ruby like Perl Elf M. Sternberg wrote: > So the wording is "Variables are created when they're first > assigned", as in Python or Perl? Perl takes this a bit farther, and calls it autovivification. (It's a very useful feature when needed, but can be confusing. Aside from the standard "assignmeng" such as: $string = "a string"; @array = qw/ a list of stuff /; Which both declare and define a scalar varable, and an array, respectively. Perl will also do: $other_array[3] = "arbitrary stuff"; $some_hash{name} = "random j. programmer"; The first statement will at once: (1) create an array @other_array and (2) set it's fourth element to a string. The second statement will at once (1) create a hash %some_hash, and (2) assign a string value to it's "name" key. This feature is used less since the 'use strict;' pragma has become such an habitual feature in scripts. Cheers, Tim Hammerquist