Help for this page

Select Code to Download


  1. or download this
    if( my $lastname = uid_lastname( \%uid, 'Alice' ) ){
        print "lastname is $lastname\n";
    }
    
  2. or download this
    sub uid_lastname {
        my( $uid, $firstname ) = @_;
    ...
        return $lastnames[0] if @lastnames;
        die "firstname not found";
    }
    
  3. or download this
  4. or download this
    my $lastname = dpath( q{/*/firstname[ value =~ /Alice/i ]/../lastname}
    + )->match( \%uid ) 
    my $lastname = dpath( q{/*/firstname/.[ value eq 'Alice' ]/../lastname
    +} )->match( \%uid ) ;