Rob, I'm going to answer the middle part of your mail first, hopefully you won't mind:
> On Tue, Jan 11, 2011 at 3:56 PM, Rob Dixon <rob.di...@gmx.com> wrote: > The link you supply talks about recent versions of push, pop, etc. > working on array references as well as arrays, so that the code could > also be written > > my $new_ref = \...@new; > > foreach (@arr) { > push $new_ref, $_; > } > > That is a long way from being able to provide any scalar value as the > first parameter of push. > > push my $scalar, {an => 'example'}, [1..10], 'Yeah!!!!!'; The arrayref is autovivified. Of course, that still breaks down if there's any defined value in the scalar - But that wasn't the point of my reply. This being a beginner's list, I imagine John was simply trying to avoid > any confusion that the mistake may have caused. I can see no other > errors in Shawn's post and don't understand how it can otherwise be made > 'less wrong'. > He is using a scalar as the first argument of push. In Perls before 5.13.7, that's illegal. In newer Perls, if the scalar is an arrayref or is undefined, that actually works, but is otherwise still illegal. The first is -always- wrong. The second is -occassionally- wrong. shawn's for example is perfectly legal, working Perl, if @arr is an array of arrayrefs. Brian.