---
name: "Perl::Critic::Policy::Community::ArrayAssignAref"
section: "3pm"
platform: "linux"
package: "libperl-critic-community-perl"
version: "1.0.4-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Perl::Critic::Policy::Community::ArrayAssignAref"
---

# Perl::Critic::Policy::Community::ArrayAssignAref(3pm)

Don't assign an anonymous arrayref to an array

## NAME

Perl::Critic::Policy::Community::ArrayAssignAref - Don't assign an anonymous arrayref to an array

## DESCRIPTION

A common mistake is to assign values to an array but use arrayref brackets `"[]"` rather than parentheses `"()"`. This results in the array containing one element, an arrayref, which is usually unintended. If intended, the arrayref brackets can be wrapped in parentheses for clarity.

```
 @array = [];          # not ok
 @array = [1, 2, 3];   # not ok
 @array = ([1, 2, 3]); # ok
```

This policy is a subclass of Perl::Critic::Policy::Plicease::ProhibitArrayAssignAref, which is a fork of the Perl::Critic::Pulp policy Perl::Critic::Policy::ValuesAndExpressions::ProhibitArrayAssignAref, and performs the same function but in the `"community"` theme.

## AFFILIATION

This policy is part of Perl::Critic::Community.

## CONFIGURATION

This policy is not configurable except for the standard options.

## AUTHOR

Dan Book, `"dbook@cpan.org"`

## COPYRIGHT AND LICENSE

Copyright 2015, Dan Book.

This library is free software; you may redistribute it and/or modify it under the terms of the Artistic License version 2.0.

## SEE ALSO

Perl::Critic, Perl::Critic::Pulp
