in reply to Re: splitting the scalar variables in an array
in thread splitting the scalar variables in an array
Thanks for the help, I modified the code but that didnt helped either. The scalar value for @dd returned by the code is as follows 1 1 4 Thats because Hostclass-A has 1 host, Hostclass B has 1 and C has 4 hosts. I want scalar(@dd) to be just 6 ( each host should be a separate element in an array )
sub gethosts { foreach $class(@hostclass) { chomp (@hosts_per_hostclass = `/opt/systems/bin/expand-hostclass --hos +ts -r $class`) ; my @dd; push @dd, split "\n", $_ for @hosts_per_hostclass; print scalar(@dd) , "\n"; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: splitting the scalar variables in an array
by sunil9009 (Acolyte) on Nov 17, 2013 at 11:05 UTC |
In Section
Seekers of Perl Wisdom