Re: [Plugins-writers] nasl hash question

From: Renaud Deraison (deraison@private)
Date: Sat Mar 13 2004 - 11:44:17 PST

  • Next message: dave@private: "Re: [Plugins-writers] nasl hash question"

    On Sat, Mar 13, 2004 at 03:16:17PM -0500, dave@private wrote:
    > After creating a hash using make_array, I'm performing a match on the index with the values contained in "myarray." The following code matches "index1" and "index4" correctly, but I would like to display the value of the hash and not the index. How would I go about this?
    > 
    > myhash = make_array('index1', "value1",
    >                     'index2', "value2",
    >                     'index3', "value3",
    >                     'index4', "value4",
    >                     'index5', "value5"
    >                 );
    > 
    > mydata = "foooooblah,foooindex1,foooooblahagain,fooindex4,foooooo, morefoooooooo";
    > myarray = split(mydata,sep:",");
    > 
    > for(i=0;myarray[i];i=i+1) {
    > foreach index (keys(myhash))  {
    > if ( ereg(string:myarray[i],pattern:index))  {
    > display(index,"\n"); #prints the hash index
    
    What about :
    
       display(myhash[index], "\n") 
    
    ?
    
    			-- Renaud
    _______________________________________________
    Plugins-writers mailing list
    Plugins-writers@private
    http://mail.nessus.org/mailman/listinfo/plugins-writers
    



    This archive was generated by hypermail 2b30 : Sat Mar 13 2004 - 12:39:59 PST