Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Tell me how it works!

by ikegami (Patriarch)
on Jan 28, 2009 at 16:14 UTC ( [id://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.

Replies are listed 'Best First'.
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.
        Dear Monk,

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

        Download drawit

        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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-16 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found