#! /usr/local/bin/perl
sub getClusters
{
my @clusters = `/qbo/bin/getclusters|grep -v 'qboc33'`;
chomp(@clusters);
return \@clusters;
}
ummm okay .. how do I get at this array to print since …
foreach $cluster (getClusters())
{ print $cluster."\n"; }
doesn’t seem to work.
Thanks.
You are returning a reference, and not dereferencing it anywhere.
OR
Either should fix it (with slightly different effects), with the first one being preferred (your array is kind of big).
You’d use the non-referenced array return for limited number of elements, usually for the purpose of multi-return (thus, usually, limited to 2 or 3, known-length arrays).