SPUG: Slice of an arrary within a hash?

Colin Meyer cmeyer at helvella.org
Fri May 5 16:40:32 CDT 2000


Daniel,

On Fri, May 05, 2000 at 12:27:54PM -0700, Daniel V. Ebert wrote:
> 
> This thread has sparked a couple questions.
> 
> 1. I haven't seen this type of thing before
> @{ $DATA{$dsku} }
> and was wondering if someone could write it out 'longhand'
> 
> If there is a bit of the Camel or Llama book that covers it I can read it  
> myself, but didn't find one im my search.

@{ $hashvar{key} } = (1..3)

is spoken in another dialect as:

$hashvar{key} = [1..3];

Personally, I find the latter version to be more clear.  I use the first 
version when an array is specifically called for, such as with push:

push @{$hashvar{key}}, 4..6;

For more detail, look to:
perldoc perlref
perldoc perldata

> 
> 2.  I often see people saying "always use strict" ... is there some  
> recommended reading on that subject?

perldoc strict

-C.

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace "action" below by subscribe or unsubscribe
           Email to majordomo at pm.org: "action" spug-list your_address





More information about the spug-list mailing list