Though mainly this is just a style thing.foreach (@users) { if (/$target/) { $rec = (split)[3]; if ($rec =~ /\D/) { next if $rec =~ /dtr/; ... etc
In addition, your outermost else block seems weird. The first test in the block is for /dtr/, which should never be true, since your outer test is for /\D/, or non-digits, which would have matched already.
When is $done set? use strict; would have alerted you that this is only used once in your code. Your script seems to be an infinite loop.
Also, a security note: if your PATH has been modified at all to cause you to run a different 'finger' than usual, or if someone is able to mangle their finger information so as to put arbitrary text on the 4th field, your `/usr/sbin/fuser -k /dev/tty$rec[3]` statement could potentially execute arbitrary code. As root, this could be a very bad thing. Consider perlsec and running with taint-checking enabled.
I don't mean for this to be a critique of your code.. I just feel you might be interested. :)
In reply to RE: Kill User
by Fastolfe
in thread Kill User
by Octavian
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |