What is the '@(' doing in this Perl code?
- by Anthony Veckey
In this code snippet:
use strict;
use warnings;
use Data::Dumper;
my $r = [qw(testing this thing)];
print Dumper($r);
foreach my $row (@({$r})
{
print "$row\n";
$row .= 'mod';
}
print Dumper($r);
print Dumper(@({$r});
I figured out that the '(' after the '@' in the foreach is causing this not to loop correctly. I have no idea why this code even works as there is no ending parenthesis. What is this doing? It looks to be creating a new variable on the fly, but shouldn't 'use strict' have fired or something?
Please help explain what that '@(' is doing and why it still runs without an ending parenthesis.