Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Tell me how it works!

by ikegami (Pope)
on Jan 28, 2009 at 16:14 UTC ( #739622=note: print w/ replies, xml ) Need Help??


in reply to Tell me how it works!

undef(@a) would give you want you want. undef isn't recursive. Undefining the glob doesn't undefine the values referenced by the glob.

Before glob assignment ---------------------- *main::a *main::b | | | +-------+ +-------+ | +--> | Glob | | Glob | <--+ +-------+ +-------+ +-------+ +-------+ | GP ----> | GP | | GP | <---- GP | +-------+ +-------+ +-------+ +-------+ +-- ARRAY | | ARRAY --+ +-------+ | +-------+ +-------+ | | Array | <-+ +-> NULL +-------+ | 1,2,3 | +-------+ After glob assignment --------------------- *main::a *main::b | | | +-------+ +-------+ | +--> | Glob | | Glob | <--+ +-------+ +--------+ +-------+ | GP ---------> | GP | <--------- GP | +-------+ +--------+ +-------+ | ARRAY --+ +--------+ | +-------+ +-> | Array | +-------+ | 1,2,3 | +-------+ After "undef *a" (Gets a fresh GP, undoing the glob assignment) ----------------- *main::a *main::b | | | +-------+ +-------+ | +--> | Glob | | Glob | <--+ +-------+ +-------+ +-------+ +-------+ | GP ----> | GP | | GP | <---- GP | +-------+ +-------+ +-------+ +-------+ +-- ARRAY | | ARRAY --+ | +-------+ +-------+ | +-------+ NULL <-+ +-> | Array | +-------+ | 1,2,3 | +-------+ If you had done "undef @a" (Clears @a) -------------------------- *main::a *main::b | | | +-------+ +-------+ | +--> | Glob | | Glob | <--+ +-------+ +--------+ +-------+ | GP ---------> | GP | <--------- GP | +-------+ +--------+ +-------+ | ARRAY --+ +--------+ | +-------+ +-> | Array | +-------+ | () | +-------+

Note that "@a=();" is usually better than "undef @a;" since it doesn't discard @a's buffer.


Comment on Re: Tell me how it works!
Select or Download Code
Re^2: Tell me how it works!
by Lawliet (Curate) on Jan 28, 2009 at 18:03 UTC

    Did you create the ascii art yourself? Seems like that would be extremely tedious to do.

    And you didn't even know bears could type.

      Yes to both.

        If you use emacs, picture-mode can help automate some of the tedium with ascii pictures like this. On the other hand, it is still tedius. :-)

        --MidLifeXis

        Dear Monk,

        It can be drawn with less efforts using the plugin "drawit" in vim editor.

        Download drawit

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://739622]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2014-08-02 07:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (55 votes), past polls