#skeys(), #sortkeys()

DESCRIPTION
    returns the number of keys in an associative array;
    maps those keys to a string variable when used as
    'for <stringvar> in #skeys(<array>)';
    the keys are sequenced in alphabetically sorted order

    or:

    returns the number of keys in an associative array;
    maps those keys to string variable s1 when used as
    'foreach #skeys(<stringvar>, <array>)';
    the keys are sequenced in alphabetically sorted order
SYNOPSIS
    #skeys(s)
    #sortkeys(s)

    or:

    #skeys(s1,s2)
    #sortkeys(s1,s2)
ARGUMENTS
     s - an associative array name

    or:

    s1 - a string variable name
    s2 - an associative array name
EXAMPLES
ACMEProcessListChange

        init
                status =piktstatus
                level =piktlevel
                task "Report changes to acme ps process list"
                input proc "=psls | =trim(160) | =egrep -i acme |
                            =egrep -iv "grep|pikt|sshd|sleep|defunct|su -|-bash" |
                            =cut -c 65-"

        rule    // add current proc to new proc list
                =incr(#procs[$inlin])

        end
                // report new procs not in old proc list
                foreach #skeys($p, #procs)
                        if ! #defined(%procs[$p])
                                output log "=acmeprocesslistchange_log" "alive:   $p"
                        fi
                endforeach
                // report old procs not in new proc list
                foreach #skeys($p, %procs)
                        if ! #defined(#procs[$p])
                                output log "=acmeprocesslistchange_log" "dead:  $p"
                        fi
                endforeach
SEE ALSO
    #members()
    #keys()
    #rkeys(), #reversekeys()

    Numerical Functions
    String Functions
 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
PIKT
problem reports