in reply to Perl 5.12.2 Data Structures

First, if you want to use the term 'geezers', I recommend you don't use nonsense text speak like 'sez'. Us 'geezers' prefer real language :P

Next, on 5.10, your code apparently works for me, without knowing what you're expecting... it runs without error:

This is perl, v5.10.1 (*) built for x86_64-linux
$ perl x.pl THIRD: 0188 - 0000007777 - 40 THIRD: 0188 - 0000009980 - 41 THIRD: 0123 - 0000008888 - 50 THIRD: 0123 - 0000009999 - 51

Do you have code that doesn't work? What error do you get when you run it? Perhaps it's due to your example of [a, b, c]. Those are unquoted values you seem to be inserting into an array reference. That won't, and has never worked. Perhaps you meant [qw(a b c)] or [('a', 'b', 'c')], like this (still on 5.10):

use strict; use warnings; use Data::Dumper; my %h; my $itemArea = 1; my $itemID = 1; $h{$itemArea}{$itemID} = [qw(a b c)]; print Dumper \%h;

Output:

$VAR1 = { '1' => { '1' => [ 'a', 'b', 'c' ] } };

If the 5.24.x docs literally state: $something = [a,b,c], please let us know where, and I'll patch it.

Also, post your *exact* error, along with the *exact* code that triggers it.

Replies are listed 'Best First'.
Re^2: Perl 5.12.2 Data Structures
by AnomalousMonk (Archbishop) on Sep 23, 2016 at 05:20 UTC

    FWIW,  [ a, b, c ] could also compile to an expression if subroutines  a() b() c() had been defined, but somehow I don't think that's what hennesse was going for.

    c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "sub a { return 'foo'; } sub b { } sub c { return 'bar'; } ;; my $array_ref = [ a, b, c ]; dd $array_ref; " ["foo", "bar"]
    (Note that  b() intentionally returns an empty list.)


    Give a man a fish:  <%-{-{-{-<