i really really recommend the perldoc pages. "perldoc perltoc" may be a good place to start
i think that you would really find it useful to study the "context" aspect of perl try answering these 1) what do you get when you evaluate a list in hash context ? (how about the other way around?) 2) what do you get when you evaluate a hash in scalar context? --- as for your first question , i am not sure why you don't like the idea of looping or why a warning is better than an explicit check . --- perldoc -f grep perldoc -f keys 2009/1/22 bc.other <[email protected]>: > OK, found that I can use the if (%tvc or %tvw) with use strict / warnings it > works (no need for defined function). > I understood it returns a value ? but can anyone tell me what this value > represent ? > > I tried this code: > my %tvc = (1 10); > my $sc = %tvc; > > print $sc; --> printing 1/8 (does it means 1 key, 8 bytes) ? > Thanks > Chanan > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On Behalf > Of Chanan Berler > Sent: Thursday, January 22, 2009 3:31 PM > To: 'Perl in Israel' > Subject: [Israel.pm] FW: check if hash is defined - without the keys > > > Hi All, > > I got a hash with key1…key25, I am looking to know if the keys are defined > or not. > But I don't like the way like: if defined($hash{key1}) or ….. > defined($hash{key5}) > > I also don't like much the idea of looping over the keys… > Q: is there a way to check if hash was defined or not….using the defined > function showed a warning… > > PS: I can stop using the use strict / warnings – and try this if (%tvc or > %tvw) – and it works… > But I still want to use them… > > Thanks > Chanan > > _______________________________________________ > Perl mailing list > [email protected] > http://perl.org.il/mailman/listinfo/perl > > _______________________________________________ > Perl mailing list > [email protected] > http://perl.org.il/mailman/listinfo/perl > -- -- vish _______________________________________________ Perl mailing list [email protected] http://perl.org.il/mailman/listinfo/perl
