Re: passing global variable by reference?

From: Don S (dshesnicky_at_yahoo.com)
Date: 02/22/04

  • Next message: John E. Pannell: "Using GD::Graph::xylines, xylinespoints..."
    Date: 22 Feb 2004 06:56:12 -0800
    
    

    > I believe this may be your problem:
    >
    > my($path,$$level,$sub,$d_flag,$f_flag,$l_flag) = @_;
    >
    > If you change it to:
    >
    > my($path,$level,$sub,$d_flag,$f_flag,$l_flag) = @_;
    >
    > and do a $$level--;
    >

    That pretty much seemed to work, should have tried
    a couple of more permutations to stumble on it :)
    documentation/smockumentation. Relevant code is:

    sub tree_walk {
       my($level,$path,$sub,$d_flag,$f_flag,$l_flag) = @_;
       <snip>
       $$level++;
       &tree_walk($level,$newpath,$sub,$d_flag,$f_flag,$l_flag);
       $level--;
       <snip>

    }

    I would have thought I needed a $$level or \$level when
    I recursively called tree_walk but I guess it makes sense
    that you have a pointer like object and once it's set you
    only need to dereference it when used via $$.

    Don


  • Next message: John E. Pannell: "Using GD::Graph::xylines, xylinespoints..."

    Relevant Pages