On Mon, 2006-08-14 at 09:13 +1200, [EMAIL PROTECTED] wrote:
> have num_of_developers=`cat /etc/passwd | grep developer | wc -l` which gives
> the number of developer logins. So how do I get it to do the same in Perl? I
untested... you get to debug it.
use strict;
my $passwd;
my $line;
my $num_developers = 0;
open( $passwd, '<', '/etc/passwd' ) or die "/etc/password failed to open
$!";
while( $line = <$passwd> ) {
num_developers++ if( $line =~ /developer/ );
}
close( $passwd);
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>