[Top] [All Lists]

perl filter skipping the line when finding a zero 0

2001-06-15 01:46:21
I have created a filter in perl that will remove multiple dashes (---+),
spaces (   +) and underscores (___+), as well as removing quoted lines.

I am not familiar with perl so I have just managed to make this by looking
at other perl scripts and doing a bit of testing...

My script looks like this:

cat test | perl -aF// -ne \
        '$l = "\n";
        while ($c = shift @F)
                exit if ++$i > 3000;
                if ($l eq "\n" && $c eq ">")
                { while (!($c eq "\n"))
                        { $c = shift @F; }
                if (!($l eq $c) || ( !($c eq " ") && !($c eq "-") && !($c
                eq "_") && !($c eq "\n")))
                        {print $c;}
                $l = $c;

My problem is that whereever test contains the character 0 (zero), the
script does not return this, nor the rest of the line following the zero.
It just continues on the next line without making a new line.

If test contains:
"This is a test. The time is 18:06 GMT+1
This is line number two in test" script will return:
"This is a test. The time is 18:This is line number two in test"

Does anyone know what's wrong with my script or how I can avoid this
happening? The script can probably be programmed with other commands as
well making it more effecitient...

Please do not only make a reply to the list, but send a copy to me as


procmail mailing list

<Prev in Thread] Current Thread [Next in Thread>