Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

clear perl hash variable

by himanshu.padmanabhi (Acolyte)
on Mar 04, 2009 at 11:38 UTC ( #748082=perlquestion: print w/ replies, xml ) Need Help??
himanshu.padmanabhi has asked for the wisdom of the Perl Monks concerning the following question:

how to clear perl hash variable in javascript? In perl,we do it using %hash={}; I am not sure in which forum I should post this. not all javascript ppl might be aware of perl hash.

Comment on clear perl hash variable
Download Code
Re: clear perl hash variable
by rovf (Priest) on Mar 04, 2009 at 12:03 UTC

    I would do it similar:

    hash={};

    -- 
    Ronald Fischer <ynnor@mm.st>
      That's how you would clear a Javascript object (which may be what the OP is after, who knows) but not a perl hash *in* Javascript.
      -derby
Re: clear perl hash variable
by derby (Abbot) on Mar 04, 2009 at 12:09 UTC

    himanshu.padmanabhi, you're post is confusing. Take a look at How do I post a question effectively?. Taken as it's written, what you're asking is odd - since the Javascript is client-side (browser) and perl is server-side (web server) and the two normally do not run together in the same process -- unless you have some funky Inline thing happening or you're doing something wild like using Javascript to create perl code.

    -derby
      And, anyway, %hash = {} does not do what himanshu.padmanabhi think it does. To clear a hash in perl, we do:
      %hash = ()
      or
      undef %hash
      or, if $hash is a hash reference,
      %$hash = ()
      or, somewhat similarly but not exactly the same,
      $hash = {}
      or, also somewhat similarly but not exactly the same,
      undef $hash
      []s, HTH, Massa (κς,πμ,πλ)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2014-08-20 13:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (113 votes), past polls