my @password_table = read_password_table(); sub get_password($$) { my ($userid, $database) = @_; my @matches = grep m/^$userid:.+:$database:/, @password_table; if ( @matches == 0 ) { warn "found no entries for $userid/$database"; return; } elsif ( @matches > 1 ) { warn "found multiple matches for $userid/$database"; return; } if ( $matches[0] =~ m/^$userid:(.+):$database:/ ) { return $1; } confess "some sort of logic error must have occurred"; }
In reply to Re: Extracting password from array
by doug
in thread Extracting password from array
by robotball
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |