in reply to Possible unintended interpolation

@servers is an array, it returns more than one value, ... try $servers[0] or use something else

Also see diagnostics

$ perl -we " qq{\@@foo} " Possible unintended interpolation of @foo in string at -e line 1. Useless use of string in void context at -e line 1. Name "main::foo" used only once: possible typo at -e line 1. $ perl -Mdiagnostics -we " qq{\@@foo} " Possible unintended interpolation of @foo in string at -e line 1 (#1) (W ambiguous) You said something like '@foo' in a double-quoted st +ring but there was no array @foo in scope at the time. If you wanted a literal @foo, then write it as \@foo; otherwise find out what happ +ened to the array you apparently lost track of. Useless use of string in void context at -e line 1 (#2) (W void) You did something without a side effect in a context that + does nothing with the return value, such as a statement that doesn't re +turn a value from a block, or the left side of a scalar comma operator. +Very often this points not to stupidity on your part, but a failure of +Perl to parse your program the way you thought it would. For example, +you'd get this if you mixed up your C precedence with Python precedence +and said $one, $two = 1, 2; when you meant to say ($one, $two) = (1, 2); Another common error is to use ordinary parentheses to construct a + list reference when you should be using square or curly brackets, for example, if you say $array = (1,2); when you should have said $array = [1,2]; The square brackets explicitly turn a list value into a scalar val +ue, while parentheses do not. So when a parenthesized list is evaluat +ed in a scalar context, the comma is treated like C's comma operator, wh +ich throws away the left argument, which is not what you want. See perlref for more on this. This warning will not be issued for numerical constants equal to 0 + or 1 since they are often used in statements like 1 while sub_with_side_effects(); String constants that would normally evaluate to 0 or 1 are warned about. Name "main::foo" used only once: possible typo at -e line 1 (#3) (W once) Typographical errors often show up as unique variable nam +es. If you had a good reason for having a unique name, then just menti +on it again somehow to suppress the message. The our declaration is provided for this purpose. NOTE: This warning detects symbols that have been used only once s +o $c, @c, %c, *c, &c, sub c{}, c(), and c (the filehandle or format) are con +sidered the same; if a program uses $c only once but also uses any of the +others it will not trigger this warning.

Replies are listed 'Best First'.
Re^2: Possible unintended interpolation
by edualfaia (Initiate) on Aug 17, 2016 at 13:49 UTC

    Thanks guys