programming-examples/perl/SystemFunction/Read password.pl

15 lines
274 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/usr/bin/perl
use warnings;
use strict;
use Text::ParseWords;
my (@users, @fields);
if (open PASSWD,"/etc/passwd") {
@users = <PASSWD>;
chomp @users; # remove linefeeds
@fields = quotewords(':', 0, @users);
close PASSWD;
}
print "@fields";