in reply to Misunderstanding dereferencing

Some old discussion on the same topic. Looks like it's a well-known bug that everyone is too scared to fix :-)

As meryln says in that thread:

an array name is sometimes automatically a reference to that array, even though the language definition would argue otherwise
--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re^2: Misunderstanding dereferencing
by dave_the_m (Monsignor) on Jan 11, 2007 at 12:05 UTC
    Looks like it's a well-known bug that everyone is too scared to fix
    Looks like its been fixed in bleed:
    $ cat /tmp/p #!/usr/bin/perl @a = qw(1 2 3); @b = qw(a b c d); push @{ $x ? @a : @b }, 'foo'; print "a: @a\n"; print "b: @b\n"; print "3: @3\n"; print "4: @4\n"; __END__ $ ./perl /tmp/p a: 1 2 3 b: a b c d 3: 4: foo

    Dave.

      I see no error so I'm wondering what is the behaviour now. Does it push 'foo' to the array @4 (@b evaluated in scalar context) ?

      Edit: sorry I didn't read to the bottom of your code...

      Edit2: more sincerity

Re^2: Misunderstanding dereferencing
by Ovid (Cardinal) on Jan 11, 2007 at 11:48 UTC

    Thank you. Glad to know I wasn't being a total idiot in getting confused on that one.

    Cheers,
    Ovid

    New address of my CGI Course.