($count,$first,$last) = $nntp->group('comp.lang.perl.misc'); $subj = $nntp->xpat( 'Subject', '*[Cc][Pp][Aa][Nn]*', [ $last - 20, $last ] ) or die "Cannot get subject lines: $!"; foreach $msgnum (keys %$subj@$news) { # Get the text of the article $article = $nntp->article($msgnum) or die "Cannot get '$msgnum': $!"; open(ARTICLE, ">$msgnum") or die "Cannot open $file: $!"; print ARTICLE @$article; close(ARTICLE); }