$" $LIST_SEPARATOR
The $" variable, also called the $LIST_SEPARATOR indicates what goes between array elements when they are intepolated in a string.
examples/list_separator.pl
use strict; use warnings; my @planets = qw( Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune ); print "@planets\n"; # Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune $" = '-'; print "@planets\n"; # Mercury-Venus-Earth-Mars-Jupiter-Saturn-Uranus-Neptune { local $" = '-^-'; print "@planets\n"; # Mercury-^-Venus-^-Earth-^-Mars-^-Jupiter-^-Saturn-^-Uranus-^-Neptune } print "@planets\n"; # Mercury-Venus-Earth-Mars-Jupiter-Saturn-Uranus-Neptune $" = ''; print "@planets\n"; # MercuryVenusEarthMarsJupiterSaturnUranusNeptune
By default it contains a single space, but you can replace it by any othere string. Including the empty string.
Unless you'd like to to impact the whole code-base it is recommended to wrap the assignment in a block (with curly braces) and use local to localize the change. (You cannot use my on this variable.)
Mnemonic: works in double-quoted context.
See also the official documentation.
Published on 2020-09-23