* Bart Lateur <bart.lateur@pandora.be> [2006-07-13 11:30]: > On Thu, 13 Jul 2006 04:29:38 -0400, Chasecreek Systemhouse wrote: > >What the advantage the above over this: > > > >perl -le 'print time' > > Oh come on, you asked how to use @{[]}. It’s a legitimate question. Another use case: for( qw( 1 2 3 ) ) { $_ = $_ * $_; # contrived print "square: $_\n"; } __END__ Modification of a read-only value attempted at foo line 2. as opposed to for( @{[ qw( 1 2 3 ) ]} ) { $_ = $_ * $_; # contrived print "square: $_\n"; } __END__ square: 1 square: 4 square: 9 In other words it’s also useful when you need to break aliasing to make sure you’re operating on a modifiable copied scalar. Regards, -- Aristotle Pagaltzis // <http://plasmasturm.org/>Thread Previous | Thread Next