Help for this page

Select Code to Download


  1. or download this
    open FH, '/etc/passwd' or die "Can't open /etc/passwd, $!";
    my @matches = grep { chomp; /thing_to_match/ } <FH>;
    
  2. or download this
    while (<FH>) {
       chomp;
       my ($name, $passwd, $uid, $gid, $quota, $comment,
           $gcos, $dir, $shell) = split /:/;
    }
    
  3. or download this
    sub my_getpwnam {
       my $name_m = shift;
    ...
       if (!@match) { return (); }  # return empty list if not found
       return split /:/, $match[0];
    }