To quote from perldoc perlsub:
The array @_ is a local array, but its elements are aliases for the actual scalar parameters. In particular, if an element $_[0] is updated, the corresponding argument is updated (or an error occurs if it is not updatable). If an argument is an array or hash element which did not exist when the function was called, that element is created only when (and if) it is modified or a reference to it is taken.
Thus the behavior of this code:
#!/usr/bin/perl -l
my @a = 1..3;
sub inc {
$_++ for @_;
}
inc(@a);
print for @a;
inc('hello');
__DATA__
2
3
4
Modification of a read-only value attempted at - line 6.