in reply to splitting the scalar variables in an array
split expects its second argument to be a string (i.e., a scalar), so using the array @TotalHosts here puts the array into scalar context, and split gets the number of elements in the array. You need to change this line:
my @dd = split "\n", @TotalHosts;
to something like this:
my @dd; push @dd, split "\n", $_ for @TotalHosts;
which calls split on each element of the array in turn. This works provided that each of the array elements is a string.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: splitting the scalar variables in an array
by afoken (Chancellor) on Nov 16, 2013 at 09:13 UTC | |
|
Re^2: splitting the scalar variables in an array
by sunil9009 (Acolyte) on Nov 17, 2013 at 10:44 UTC | |
by sunil9009 (Acolyte) on Nov 17, 2013 at 11:05 UTC |