Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^6: var comparison

by nemesisgus (Acolyte)
on Sep 09, 2012 at 02:03 UTC ( #992550=note: print w/ replies, xml ) Need Help??


in reply to Re^5: var comparison
in thread var comparison

Nice hash slice, thanks!

Just let me polish up your code so other newbies don't get confused:

my %option; @option{qw/a b c/}=(); # my %option = ( # 'a' => undef, # 'b' => undef, # 'c' => undef # ); exists $option{a} and print 'true'; exists $option{d} or print 'false';

PS: what the h**l is DB <...> ?


Comment on Re^6: var comparison
Select or Download Code
Re^7: var comparison
by Anonymous Monk on Sep 09, 2012 at 08:47 UTC
    DB <...> : the code was run under the debugger. Example of a debugger session:
    $ perl -de 42 Loading DB routines from perl5db.pl version 1.32 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 42 DB<1> %hash = qw( a 1 b 2 c 3 d 4 ); DB<2> print %hash c3a1b2d4 DB<3> print scalar %hash 4/8 DB<4> $hash{e} = undef DB<5> print scalar %hash 5/8 DB<6> print "true" if defined $hash{e} DB<7> print "true" if exists $hash{e} true DB<8>

      So much to learn... Thank you again!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2014-10-25 23:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (149 votes), past polls