Re: a nice little perl utility
- From: "Wade Ward" <zaxfuuq@xxxxxxxxxxx>
- Date: Sat, 20 Oct 2007 23:23:36 -0700
"Ron Bergin" <rkb@xxxxxxxxxx> wrote in message
news:1192936149.250861.44970@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Oct 20, 6:48 pm, "Wade Ward" <zaxf...@xxxxxxxxxxx> wrote:
It's Officially Okay to make large mistakes with a new syntax.I've been working with the hints that have been given on how to make
ActivePerl, and I've got a long way to go.
I now put s cript at the end of a sript that becomes what I feed my dos
window. As in this:
You do a very good job of making yourself incomprehensible.
How did this have to do with the print statement?I can't shake these warnings, and I don't know what they're coming from:You need to clearly point out to us those lines of code so we can help
Use of uninitialized value in concatenation (.) or string at jabba5.pl
line
65.
Use of uninitialized value in concatenation (.) or string at jabba5.pl
line
67.
Use of uninitialized value in concatenation (.) or string at jabba5.pl
line
75.
you.
Due to your addition of the comments after the fact that don't fullyYou got it.
correspond with the line numbers stated at the beginning, I can't be
sure, but I'd say that the printing of $words[3] is the cause of the
"Use of uninitialized value in concatenation". Your print statement
that outputs the $s4 var clearly shows that it holds 3 "words".
$words[3] would be the 4th word, if there was one.
final version of this script for today:
#!/usr/bin/perl
#!/usr/bin/perl she still bangs
## jabba6.pl, 2007-10-20
##minimal nntp client
##manipulates strings in the subject lines
## contributors: Michele, Tad, Ron
use strict;
use warnings;
use Net::NNTP ();
use constant NUMBER_OF_ARTICLES => 1;
use constant GROUP_NAME => 'comp.lang.perl.misc';
use constant SERVER_NAME => 'newsgroups.comcast.net';
use constant NNTP_DEBUG => 0;
my $nntp = Net::NNTP->new(SERVER_NAME, 'Debug' => NNTP_DEBUG) or die;
my $USER = '';
my $PASS = '';
$nntp->authinfo($USER,$PASS) or die $!;
my($article_count, $first_article, $last_article) =
$nntp->group(GROUP_NAME) or die;
# Which XOVER fields contain Subject: and From:?
my $count = 0;
my %xover_fmt = map( ($_, $count++), @{ $nntp->overview_fmt or die} );
die unless exists $xover_fmt{'Subject:'};
my $subject_offset = $xover_fmt{'Subject:'};
my $from_offset = $xover_fmt{'From:'};
my(@xover, $start_article);
RETRIEVE: while ($#xover+1 < NUMBER_OF_ARTICLES and $last_article >=
$first_article) {
# How many articles do we need? Stop retrieving if we have enough
my $articles_required = NUMBER_OF_ARTICLES - ($#xover+1) or last
RETRIEVE;
# Fetch overview information for the articles
$start_article = $last_article - ($articles_required-1);
$start_article = $start_article > $first_article ? $start_article :
$first_article;
my $xover_query = $start_article == $last_article ?
$start_article :
[$start_article, $last_article];
my $xover_ref = $nntp->xover($xover_query) or die;
# Store headers for the articles we've retrieved
foreach (sort {$b <=> $a} keys %$xover_ref) {
push @xover, $xover_ref->{$_};
}
} continue {
# Move the pointer forward to fetch previous articles
$last_article = $start_article - 1;
}
# Disconnect from the NNTP server
$nntp->quit;
# this isUseless use of a constant in void context at jabba5.pl line
#57.
#Use of uninitialized value in concatenation (.) or string at jabba5.pl
#line 64.
my $s4 = join("\n", map ($_->[$subject_offset],@xover));
# fucksyntax error at jabba4.pl line 59, near "fuck
# this is line 60 pardon my french ^^^^^^^^^^^^^^
print STDOUT " s4 is $s4\n";
my @words = split " ", $s4;
$words[0] = reverse $words[0];
#big finish
print STDOUT " $words[1] $words[2] ";
print STDOUT " $words[0] \n";
__END__
# perl jabba6.pl 2>text28.txt >text29.txt
Cheers,
--
wade ward
"Nicht verzagen, Bruder Grinde fragen."
.
- References:
- a nice little perl utility
- From: Wade Ward
- Re: a nice little perl utility
- From: John W. Krahn
- Re: a nice little perl utility
- From: Wade Ward
- Re: a nice little perl utility
- From: Ron Bergin
- a nice little perl utility
- Prev by Date: Re: polymorphic regex -- encoding issue
- Next by Date: splitting a line
- Previous by thread: Re: a nice little perl utility
- Next by thread: FAQ 5.21 I still don't get locking. I just want to increment the number in the file. How can I do this?
- Index(es):