in reply to Re^3: Using Variable outside of loop with Net::SSH
in thread Using Variable outside of loop with Net::SSH

if you have other code inside the loop which you've removed for the sake of this sample, make sure it's not changing the value of $_ before you assign it to $result

Excellent point. So why not play it safe and dispense with $_ altogether?

my $result; while ($result = <$chan>) { ... } # use $result

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,