F
Fred
The script below lists ALL news groups for a particular news
server using the module. The list returned
looks similar to this with the group name, first article#,
last article#, and 'y' or 'n' if posting is allowed:
alt.test 0003911619 0003889349 y
alt.test-ns 0000006714 0000003335 y
alt.test.9 0000004684 0000002874 y
alt.test.a 0000057454 0000042977 y
The list is printed using "print $c->list()" (See below). I'm
trying to parse just the newsgroup name, so the list above
would look like:
alt.test
alt.test-ns
alt.test.9
I tried unsuccessfully using split like this:
my ($grpname, $first, $last, $postingallowed) = split(/ /, print
$c->list('active', 'alt.test*'));
print "$grpname\n";
I know I can parse the output and truncate 3 spaces to the right,
but is there a way to do this witrhin the script?
-Thanks
#!/usr/bin/perl -w
use strict;
use
my $newshost = 'news.sprynet.com';
my $username = '(e-mail address removed)';
my $password = 'mypass';
my $port = '119';
# Connect to news server on port 119, debug level 1.
my $c = new $port, 1);
unless ($nc->ok()) {
$nc->quit();
die $nc->message();
}
$c -> authinfo($username,$password);
print $c->list();
$c->quit();
server using the module. The list returned
looks similar to this with the group name, first article#,
last article#, and 'y' or 'n' if posting is allowed:
alt.test 0003911619 0003889349 y
alt.test-ns 0000006714 0000003335 y
alt.test.9 0000004684 0000002874 y
alt.test.a 0000057454 0000042977 y
The list is printed using "print $c->list()" (See below). I'm
trying to parse just the newsgroup name, so the list above
would look like:
alt.test
alt.test-ns
alt.test.9
I tried unsuccessfully using split like this:
my ($grpname, $first, $last, $postingallowed) = split(/ /, print
$c->list('active', 'alt.test*'));
print "$grpname\n";
I know I can parse the output and truncate 3 spaces to the right,
but is there a way to do this witrhin the script?
-Thanks
#!/usr/bin/perl -w
use strict;
use
my $newshost = 'news.sprynet.com';
my $username = '(e-mail address removed)';
my $password = 'mypass';
my $port = '119';
# Connect to news server on port 119, debug level 1.
my $c = new $port, 1);
unless ($nc->ok()) {
$nc->quit();
die $nc->message();
}
$c -> authinfo($username,$password);
print $c->list();
$c->quit();