in reply to how is this uninitialized?

Another way to do it, other than the fine way shown by dragonchild:

my $hodown = @downhosts; my $houp = @uphosts; print "There are $hodown hosts down\n"; print "There are $houp hosts alive\n\n";

Sorry for the variable names, I couldn't resist. This has the benefit of allowing simpler interpolation in a string, and doesn't require the explicit use of scalar. It has the detriment of creating two superfluous variables. I am not necessarily advocating any particular solution, just giving another option. :-)

Replies are listed 'Best First'.
Re^2: how is this uninitialized?
by redlemon (Hermit) on Dec 29, 2004 at 14:10 UTC

    Or, while we're giving alternatives:

    print <<"REPORT" There are @{[ scalar @downhosts ]} hosts down There are @{[ scalar @uphosts ]} hosts up The following hosts are alive: @{[ join "\n\t" => @uphosts ]} The following hosts are down: @{[ join "\n\t" => @downhosts ]} REPORT

    I like inline expansions, apparently perl6 is supposedly going to make that easier.