Perl has a lot of different literals
- Numbers like
123, 123.0, 1.23e2, 0x7b
- String literals
"abc", 'abc', q/abc/, …
- Barewords
- Barewords look like function calls without a param list
- In special places, this is OK even under strict:
Foo::Bar->new()
- without
strict 'refs', barewords that don't signify subs are treated as strings.
- the LHS of the fat comma
=> is always autoquoted
- Barewords with leading minus are always strings, unless they are file-test operators.
-abc eq "-abc"
- V-strings (V as in vector, or version).
v1.2.3
V-strings consist of a sequence of numbers that are seperated by a period. Each of the numbers is translated to a corresponding character. As they are strings, they can be compared with lt, gt, etc.
They are good for e.g. IP addresses, or version numbers. They are not good for being printed out, as low numbers signify unprintable characters.
$ perl -E'say v49.50.51'
123
The moral of the story? Always use strict; use warnings;, and maybe look into the qw// quoting operator:
my $variables_array = [[qw/u1 answer1 Uvalue/], [qw/v1 u2 v2 answer2 Vvalue/]];
# or verbose:
my $variables_array = [['u1', 'answer1', 'Uvalue'], ['v1', 'u2', 'v2', 'answer2', 'Vvalue']];
(qw does not interpolate, splits the string at any whitespace, and is equal to the list of strings)