Re: [Plugins-writers] nasl hash question

From: dave@private
Date: Sat Mar 13 2004 - 13:41:48 PST

  • Next message: dave@private: "[Plugins-writers] converting hex to dec"

    On Sat, Mar 13, 2004 at 02:44:17PM -0500, Renaud Deraison wrote:
    > 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") 
    > 
    > ?
    
    that did it. Thank you - and Michel - very much.
    
    -dave
    _______________________________________________
    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 - 13:03:20 PST