in reply to Re: Re: Peruse my code...
in thread Peruse my code...

This is what i have come up with so far, but it doesn't work. Any suggestions?
#!/usr/bin/perl @file = `ls /var/log/accounts`; foreach $file { open(FILE, "<$file") || die; @account=<FILE>; close(FILE); foreach $account { ($username, $domain, $email, $service) = split(/,/, $account); # # Insert rest of my code here # } unlink $file; }

Replies are listed 'Best First'.
Re: Re: Re: Re: Peruse my code...
by jepri (Parson) on Aug 31, 2002 at 14:18 UTC
    Try typing ls /var/log/accounts into the command shell. You need to change this line:

    open(FILE, "</var/log/accounts/$file") || die;

    I make the same mistake all the time.

    ____________________
    Jeremy
    I didn't believe in evil until I dated it.

      thanks. i will give that a go. apart from that, can you see any reason why that script wouldn't work? are there any security issues involved with this?
        If you are doing accounting stuff through a web interface, then that's your biggest security hole. Only expose what you absolutely need to through CGI. As for the rest, make sure the files have the right permissions (more importantly, that they cannot be accessed by those without permission). Make sure you aren;t assuming anything dangerous about where your information is coming from or going to (could someone put in some crap information and corrupt the system?). Check out things like Ovids CGI writings for more info.

        ____________________
        Jeremy
        I didn't believe in evil until I dated it.