in reply to Re^2: Soft Array Refs
in thread Soft Array Refs
... single quotes around '@table' ...
If double-quotes has been used, double-quotish interpolation of an array named @table_ would have been attempted and, with strict fully enabled (as it is in Athanasius's code), would have crashed compilation. Single-quotes do not interpolate. (Update: The @ sigil could also be escaped in double-quotes.)
c:\@Work\Perl\monks>perl -le "use warnings; use strict; ;; print qq{@table}; " Possible unintended interpolation of @table in string at -e line 1. Global symbol "@table" requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors. c:\@Work\Perl\monks>perl -le "use warnings; use strict; ;; my @table = qw(fee fie foe); ;; print qq{double-quote array interpolation: (@table)}; ;; print q{single-quote, no interpolation: (@table)}; ;; print qq{double-quote, sigil escaped: (\@table)}; " double-quote array interpolation: (fee fie foe) single-quote, no interpolation: (@table) double-quote, sigil escaped: (@table)
Update: Changed code examples to consolidate compiling code examples into single group of statements.
Give a man a fish: <%-(-(-(-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Soft Array Refs
by smknjoe (Beadle) on Jun 25, 2015 at 15:30 UTC |