#!/usr/local/bin/perl

open(STDOUT, ">out.tmp");
open(FILE2, ">out");

system("ls -l /var/spool/mail");
close(STDOUT);

open(LISTFILE, "out.tmp");

while($a = <LISTFILE>)
{
        @b = split(' ',$a);

        if ( ($b[2] ne $b[8]) || ($b[4]>500000) ) 
        { 
           select(FILE2);
           print $a;
        } 
}

close(FILE2);
close(LISTFILE);

system("rm -f out.tmp");