in reply to Re^2: splitting the scalar variables in an array
in thread splitting the scalar variables in an array

Consider this resolved, foreach was printing it 3 times. Final working code is as follows. Thanks to all of you guys fo the pointers.

sub gethosts { foreach $class(@hostclass) { chomp (@hosts_per_hostclass = `/opt/systems/bin/expand-hostclass --hos +ts -r $class`) ; #print "@hosts_per_hostclass \n"; push @dd, split "\n", $_ for @hosts_per_hostclass; } return @dd; }