in reply to Problem with hash slice.

MrSparks:

You almost had it--your mistake was using parentheses. For an array slice, you use brackets:

my @array = (0, 1, 2, 3, 4, 5); my @temp = @array[1..3];

For hash slices, you use braces:

my @nationalities = @nationality_of{'Ovid', 'Tennyson'};

The first message is a warning, but you can ignore it, because it'll go away once you fix the previous error. (The line that declared the array has a syntax error, so @nationalities never got properly declared.)

...roboticus

When your only tool is a hammer, all problems look like your thumb.