perl.macperl...MacPerl using references with hashes by Louis Pouzin- August 5, 2005 On Wed, 3 Aug 2005 18:21:14 -0400, Joshua Juran wrote:>my $ref = $Honetwothree0;> Either of these should work>delete %$reffour if exists %$reffour;>delete $ref->four if exists $ref->four;Joshua, I tried those tests and got the following diags:delete %$reffour if exists %$reffour; Can&39;t use subscript on hash derefdelete $ref->four if exists $ref->four; Not a HASH referenceIt&39;s the same with MacPerl 5.20r4 and Perl 5.008004.Finally, what works is:delete...http://www.nntp.perl.org/group/perl.macperl/2005/08/msg3074.html Re: MacPerl using references with hashes by Joshua Juran- August 3, 2005 On Aug 3, 2005, at 10:01 AM, Louis Pouzin wrote:> To avoid cluttering scripts with intricate expressions I tried > references,> with mixed results. e.g. instead of:>> delete $Honetwothree0four if exists > $Honetwothree0four;>> I&39;d prefer to write:> $ref = $Honetwothree0four;> delete $$ref if exists $$ref; or somesuch.>> While I could get each, keys, and values, out of references, I haven&39;t > figured> out a working syntax for exists,...http://www.nntp.perl.org/group/perl.macperl/2005/08/msg3073.html MacPerl using references with hashes by Louis Pouzin- August 3, 2005 Good morningafternoonnight,To avoid cluttering scripts with intricate expressions I tried references, with mixed results. e.g. instead of: delete $Honetwothree0four if exists $Honetwothree0four;I&39;d prefer to write: $ref = $Honetwothree0four; delete $$ref if exists $$ref; or somesuch.While I could get each, keys, and values, out of references, I haven&39;t figured out a working syntax for exists, delete, and growing hashes.Perhaps someone could suggest a right way. Thanks.http://www.nntp.perl.org/group/perl.macperl/2005/08/msg3072.html Re: MacPerl when delete hash creates one by Joshua Juran- August 2, 2005 On Aug 2, 2005, at 8:31 PM, Louis Pouzin wrote:> While tracking some mysteries in a script behavior I hit an > interesting feature.> "DELETE hash element" seems to create one, when it&39;s missing. It may > be normal> and well known in the Perl milieu, but new to me.>> delete $H$ip;> delete $H$ipany; create $H$ip>> It looks as if Perl processes DELETE as follows:> 1- create the missing element> 2- delete the terminal element, as...http://www.nntp.perl.org/group/perl.macperl/2005/08/msg3071.html MacPerl when delete hash creates one by Louis Pouzin- August 2, 2005 Hi list,While tracking some mysteries in a script behavior I hit an interesting feature."DELETE hash element" seems to create one, when it&39;s missing. It may be normal and well known in the Perl milieu, but new to me.Here is a test script, a baby scenario of new records updating an archive- - -!usrlocalbinperl -w delete hash element creates oneuse strict; $ = "n";my %H=(); my...http://www.nntp.perl.org/group/perl.macperl/2005/08/msg3070.html Re: MacPerl how to grow a hash of hashes by Detlef Lindenthal- August 1, 2005 Louis ecrire: > It would be interesting to assess each scheme > in terms of resource requirements > (running time and memory). You are write, and hashes should not be bigger than "medium size" ;-) at least MacPerl hashes. You can put one complete URL into one hash record: print "nn======= Test per pedes: ======n";$H&39;64.207.97.183&39;nggovnigeriawwwis_read=1;$H&39;64.207.97.183&39;nggovnigeriais_read=1; The following might be slimmer.http://www.nntp.perl.org/group/perl.macperl/2005/08/msg3069.html MacPerl how to grow a hash of hashes by Louis Pouzin- August 1, 2005 Guten Nachmittag,On Sat, 30 Jul 2005 19:37:43 +0200, Detlef Lindenthal wrote: Just for clarity: What is your distinction between "domain" and"name" "Domain" the first two levels, and the rest "name"In my posting I used "name" for the whole, e.g. www.nigeria.gov.ng.and "domain" for the 2 top levels, e.g. gov.ng. Try this, add a hash entry...http://www.nntp.perl.org/group/perl.macperl/2005/08/msg3068.html MacPerl how to grow a hash of hashes by Louis Pouzin- August 1, 2005 On Sat, 30 Jul 2005 14:11:58 -0400, Ronald J Kimball wrote:>Why do you say it erases all previous keys in the hashBecause I tried it. Or so I thought. Clearly I must have got mixed up in my multiple tests in the wee hours.- -!usrlocalbinperl -w test growing array of hashesuse strict; $ = "n";my %H = (); my $ip = &39;64.207.97.183&39;;$H$ip0 = &39;nam1&39;,&39;&39;,&39;nam2&39;,&39;&39;,&39;nam3&39;,&39;&39;;printk();$H$ip0nam4 = &39;&39;; add one keyprintk();sub printk local...http://www.nntp.perl.org/group/perl.macperl/2005/08/msg3067.html |