Question about variable scope



In the code snippet below, why can't I access the $nntp variable, unless I
instantiate it within the ListGroups() subroutine?

-Thanks



#!/usr/bin/perl -w

#This nntp instance cannot be used in ListGroups()
#sub below:

# $nntp = Net::NNTP->new($newshost);
# $nntp->authinfo($username,$password);
..
..
..

sub ListGroups()
{
#Need to instantiate $nntp here for this to work:

$nntp = Net::NNTP->new($newshost);
$nntp->authinfo($username,$password);

my $groups = $nntp->list() or die "Cannot get group list";

print join("\n", keys %$groups), "\n";

$nntp->quit();

return(0);
}

.