[Purdue-pm] Perl 6 example: print missing home directories
Mark Senn
mark at purdue.edu
Fri Jul 30 19:07:40 PDT 2010
#!/home/pier/e/mark/=sw/redhat5/x86/bin/perl6
#
# t.p6 2010-07-30 Mark Senn http://engineering.purdue.edu/~mark
#
# One way to print the login and homedir for all missing home directories
# on Linux or Solaris.
#
# Usage:
# t.pl
#
my $fn = '/etc/passwd';
my $fh = open $fn, :r;
for $fh.lines {
my ($login,$homedir) = $_.split(':')[0,5];
$homedir.IO.e or printf "%-8s %s\n", $login, $homedir;
}
More information about the Purdue-pm
mailing list