What is the @.
variable in perl?
It appears be a special, writeable global, and (surprisingly) does not interpolate in double-quoted strings:
use strict;
use warnings;
# Under 5.8, 5.10, 5.12, 5.14, and 5.16,
# the following lines produce:
@. = (3, 2, 1); # no error
print "@.\n"; # "@."
print @., "\n"; # "321"
eval 'my @.; 1' # Can't use global @. in "my" at (eval 1)
or die $@; # line 1, near "my @."
I couldn't recall ever encountering it before, and didn't see it in perlvar
nor perldata
.
perldoc perlvar states:
Perl variable names may also be a sequence of digits or a single punctuation or control character. These names are all reserved for special uses by Perl;
and
Perl identifiers that begin with digits, control characters, or punctuation characters are exempt from the effects of the package declaration and are always forced to be in
package main
; they are also exempt fromstrict 'vars'
errors.
You are using a reserved name. You should not expect to be able to rely on any features.
$.
is current line number (or record number) of most recent filehandle.
@.
has no special meaning or use
"@."
does not interpolate, but "@{.}"
does.
@.
is reserved for future use and should not be used
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With