Hi to all,
I've just learnt ( ... anyway, I'm trying to do it) to select a string when it is not preceded (or followed) by another string.
My aim is to know the mean of text lines in each newsgroup post, so I wrote:



#!/usr/bin/perl -w

$nome_del_file = q/text.txt/;

open(INPUT, $nome_del_file);

$posts = 0;
$line4post = 0;

while (<INPUT>)
{
# it cleans the <return carriage> signs
tr/\015|\012/\n/;
# it makes a lot of <new line> signs only one a time
tr/\n\r\f\t//s;
# it counts all the posts
$posts ++ if /Newsgroups: it\..+/;
# it deletes the headers of each post
s/Newsgroups: it\..+|Subject: .+|Date: .+|Message-ID: .+|References: ..+|From: .+/\n/g;
# THIS ONE DOESN'T WORKS!!! it should count all the lines except the lines of division of each post (========\n)
$line4post ++ if (/\n/ and $´ !~ /={8}/);
}
print $posts, " posts in ", $line4post, " lines.\nThe mean is ", $line4post / $posts, " lines for post.\n";

close(INPUT);

someone knows why for each line of text.txt the Terminal tells me: "Use of uninitialized value in pattern match (m//) at [...]" and how can I avoid it?
thanks,

all'adr


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to