[31215] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2460 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 5 03:09:42 2009

Date: Fri, 5 Jun 2009 00:09:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 5 Jun 2009     Volume: 11 Number: 2460

Today's topics:
        Applications <edgrsprj@ix.netcom.com>
    Re: Applications sln@netherlands.com
    Re: Applications <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: Applications <edgrsprj@ix.netcom.com>
    Re: Applications sln@netherlands.com
        new CPAN modules on Fri Jun  5 2009 (Randal Schwartz)
    Re: print buffer in Perl 5.10 <john1949@yahoo.com>
        Tell me the Flintstones HoH has 22 things jidanni@jidanni.org
    Re: Tell me the Flintstones HoH has 22 things <yankeeinexile@gmail.com>
    Re: Tell me the Flintstones HoH has 22 things sln@netherlands.com
    Re: Tell me the Flintstones HoH has 22 things <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: Tell me the Flintstones HoH has 22 things <uri@StemSystems.com>
    Re: Tell me the Flintstones HoH has 22 things sln@netherlands.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 4 Jun 2009 21:00:14 -0500
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Applications
Message-Id: <gbKdnX2BYd-74bXXnZ2dnUVZ_qWdnZ2d@earthlink.com>

"Charlton Wilbur" <cwilbur@chromatico.net> wrote in message 
news:86fxefzuhf.fsf@mithril.chromatico.net...

> This is irrelevant to your question.

Thanks for the comments.  Once again, the programming philosophy is somewhat 
different for the questions I am asking than for probably most of the 
questions other people are asking.

To a large extent, the programs I am developing are designed to simply show 
various organizations that a certain type of application will work and what 
it can accomplish.  If they like the application then they can have their 
own programmers duplicate and expand it using Perl if they like, or whatever 
other language they prefer.  I expect that in most cases it would be one of 
the C family languages.

So, these demonstration programs don't need perfect code.  All they need to 
do is show that something can be done.  And the IsKeyPressed command was not 
producing the needed result for all of the applications I have been 
developing.

As I have been saying, Perl combined with Gnuplot is an excellent language 
pairing for doing this type of work.  And the combination of IsKeyPressed, 
ReadKey, and readline will apparently get the job done for these 
demonstration programs.  Also with my other Perl Newsgroup information 
requests, for the most part, all I need is something that will work. 
Experienced programmers can fill in the blanks if governments etc. like an 
application.

Another approach to the key press question with Windows is to have the Perl 
program start some independently running Windows program that would read the 
key presses and dump the results into a file that the Perl program and other 
programs could check say 10 times a second to see if some key has been 
pressed.  That would take care of the entire matter.  And I am planning to 
explore that approach with some Windows experts.



------------------------------

Date: Thu, 04 Jun 2009 20:19:01 -0700
From: sln@netherlands.com
Subject: Re: Applications
Message-Id: <drvg251dpl0kisi5hmjag43so1cnudotg7@4ax.com>

On Thu, 4 Jun 2009 21:00:14 -0500, "E.D.G." <edgrsprj@ix.netcom.com> wrote:

[snip]

>Another approach to the key press question with Windows is to have the Perl 
>program start some independently running Windows program that would read the 
>key presses and dump the results into a file that the Perl program and other 
>programs could check say 10 times a second to see if some key has been 
>pressed.  That would take care of the entire matter.  And I am planning to 
>explore that approach with some Windows experts.

You know of course about layered device drivers. Some keyboard companies
insert thier own driver in the chain, or even bypass the chain, enableing
them to do hot keys and so forth. This is a simple matter to do.

It all has to do with the interrupt mask. The driver sets the mask, inserts
itself in the device chain, catches the interrupt then reads the port.

The driver can be installed by calling CreateFile() with the driver name,
returning a handle by which you can communicate immediate with DeviceIoControl(),
immediate (if needed), then queue up asynchronous read requests with ReadFile()
using OverlappedIO.
That user mode process that starts the device, can be an intermediary to
another processes, your Perl program.

This will not cause any detriment to the normal windows message loops as your 
inserted device will just be an observer. That is, unless you want it to skip
passing along certain IRP's to the rest in the chain (with that affinity),
which of course you can control from the user mode monitor app, to do or not,
with discression. Of course, the other app's will not like this (should you
choose to be an active paricipant of change).

But, then your back to square 1, your user mode app will have to communicate
with a running perl app via a pipe.

Seems kind of silly huh?

Btw, if I inserted a file system overlay driver (filter), was protecting my file from
being seen by user mode win32, you would have no way of seeing it or removeing it
without being able to boot up without my driver being installed. Now days they call
that a rootkit. Once a kernel mode driver is installed, it lives in a veritable
play ground of OS lovelynes, able to do anything it wants.

I'm really glad we had this opportunity to talk.


-sln


------------------------------

Date: Thu, 4 Jun 2009 20:14:06 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Applications
Message-Id: <v4fmf6xqu7.ln2@goaway.wombat.san-francisco.ca.us>

On 2009-06-05, E.D.G. <edgrsprj@ix.netcom.com> wrote:
>
> Thanks for the comments.  Once again, the programming philosophy is somewhat 
> different for the questions I am asking than for probably most of the 
> questions other people are asking.

That seems impossibly unlikely.

> To a large extent, the programs I am developing are designed to simply show 
> various organizations that a certain type of application will work and what 
> it can accomplish.  If they like the application then they can have their 
> own programmers duplicate and expand it using Perl if they like, or whatever 
> other language they prefer.

Thank you for making my point so quickly.

--keith


-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information



------------------------------

Date: Thu, 4 Jun 2009 23:58:57 -0500
From: "E.D.G." <edgrsprj@ix.netcom.com>
Subject: Re: Applications
Message-Id: <yqadnZezO_SVO7XXnZ2dnUVZ_v6dnZ2d@earthlink.com>

<sln@netherlands.com> wrote in message 
news:drvg251dpl0kisi5hmjag43so1cnudotg7@4ax.com...

What is presently being considered is having a Visual Basic program for 
example watch for key presses.  If it saw one it might store information 
such as the words "Right Arrow" in a file called c:\keypress.txt.  It might 
also clear the keyboard buffer at the same time.  Perl, Basic, Fortran or 
even Gnuplot programs that were running at the time would check the contents 
of the keypress.txt file perhaps ten times a second and act on whatever key 
press information they found in the file.  The key checking program would be 
started with a system command linked if necessary with a Windows shortcut. 
And it might be sent an End command through some other text file that it 
checked itself. File sharing like that does not appear to be a problem if 
certain precautions are taken. One reason for doing this is to have Gnuplot 
draw a plot and then have different things display on the plot when various 
keys are pressed. Having Perl send Gnuplot commands and data through a pipe 
appears to be fast enough for my own applications.



------------------------------

Date: Thu, 04 Jun 2009 22:14:13 -0700
From: sln@netherlands.com
Subject: Re: Applications
Message-Id: <6m9h25p3pp9sci1b0cucre63ns3h8oj0km@4ax.com>

On Thu, 4 Jun 2009 23:58:57 -0500, "E.D.G." <edgrsprj@ix.netcom.com> wrote:

><sln@netherlands.com> wrote in message 
>news:drvg251dpl0kisi5hmjag43so1cnudotg7@4ax.com...
>
>What is presently being considered is having a Visual Basic program for 
>example watch for key presses.  If it saw one it might store information 
>such as the words "Right Arrow" in a file called c:\keypress.txt.  It might 
>also clear the keyboard buffer at the same time.

We are talking about Windows. Windows, at its lower level core, is a collection of,
using the Dos analogy, multiple, single process machines.

There is a reason the term 'focus' was pattented by Mshit. The FOCUS is a
very big deal on the Wondows OS, very big!! You don't understand that, thats why
I snipped all your other stuff.

I guess you could get in touch with primitavies that do DeviceIoControl but probably
not unless you have the FOCUS. Its a circular, spiraling argument, leading to a
black hole, event horizon as far as the OS is concerned.

Unless the process EXCLUSIVELY owns the standard device/device chain, there is no construct
the OS will allow that will, accros the board, clear the 'keyboard buffer'.
This is not Dos 2.0, and VB is way down on the food chain.

-sln


------------------------------

Date: Fri, 5 Jun 2009 04:42:31 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Fri Jun  5 2009
Message-Id: <KKr12v.20B8@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

App-ForExample-0.02
http://search.cpan.org/~rkrimen/App-ForExample-0.02/
A guide through Catalyst, Apache, lighttpd, nginx, monit, ..., configuration hell 
----
Audio-Scan-0.16
http://search.cpan.org/~agrundma/Audio-Scan-0.16/
Fast C parser for MP3, MP4, Ogg Vorbis, FLAC, ASF, WAV, AIFF, Musepack, Monkey's Audio 
----
Bio-DB-Das-Chado-0.23
http://search.cpan.org/~scain/Bio-DB-Das-Chado-0.23/
DAS-style access to a chado database 
----
Bio-Das-1.11
http://search.cpan.org/~lds/Bio-Das-1.11/
Interface to Distributed Annotation System 
----
Bio-Graphics-1.96
http://search.cpan.org/~lds/Bio-Graphics-1.96/
Generate GD images of Bio::Seq objects 
----
Bot-BasicBot-Pluggable-0.72
http://search.cpan.org/~mdom/Bot-BasicBot-Pluggable-0.72/
extended simple IRC bot for pluggable modules 
----
CGI-Application-Plugin-Routes-1.02
http://search.cpan.org/~porta/CGI-Application-Plugin-Routes-1.02/
Routes-style dispatching for CGI::Application 
----
CGI-Application-Plugin-ValidateQuery-0.99_1
http://search.cpan.org/~natek/CGI-Application-Plugin-ValidateQuery-0.99_1/
lightweight query validation for CGI::Application 
----
CGI-Inspect-0.3
http://search.cpan.org/~awwaiid/CGI-Inspect-0.3/
Inspect and debug CGI apps with an in-browser UI 
----
Catalyst-Controller-WrapCGI-0.019
http://search.cpan.org/~rkitover/Catalyst-Controller-WrapCGI-0.019/
Run CGIs in Catalyst 
----
ClearPress-334
http://search.cpan.org/~rpettett/ClearPress-334/
Simple, fresh & fruity MVC framework - http://clearpress.net/ 
----
Data-Dump-XML-1.11
http://search.cpan.org/~apla/Data-Dump-XML-1.11/
Dump arbitrary data structures as XML::LibXML object 
----
Data-Validate-IP-0.10
http://search.cpan.org/~neely/Data-Validate-IP-0.10/
ip validation methods 
----
Getopt-Chain-0.015
http://search.cpan.org/~rkrimen/Getopt-Chain-0.015/
Command-line processing like svn and git 
----
HTML-Element-Replacer-0.02
http://search.cpan.org/~tbone/HTML-Element-Replacer-0.02/
simplify the HTML::Element clone() - push_content() ritual 
----
HTTP-Engine-Middleware-0.14
http://search.cpan.org/~yappo/HTTP-Engine-Middleware-0.14/
middlewares distribution 
----
HTTP-MobileAttribute-0.16
http://search.cpan.org/~tokuhirom/HTTP-MobileAttribute-0.16/
Yet Another HTTP::MobileAgent 
----
IO-Socket-Telnet-0.03
http://search.cpan.org/~sartak/IO-Socket-Telnet-0.03/
transparent telnet negotiation for IO::Socket::INET 
----
Jorge-0.02
http://search.cpan.org/~porta/Jorge-0.02/
ORM Made simple. 
----
Language-Befunge-4.11
http://search.cpan.org/~jquelin/Language-Befunge-4.11/
a generic funge interpreter 
----
Mail-IMAPClient-3.18
http://search.cpan.org/~plobbes/Mail-IMAPClient-3.18/
An IMAP Client API 
----
MsOffice-Word-HTML-Writer-0.04
http://search.cpan.org/~dami/MsOffice-Word-HTML-Writer-0.04/
Writing documents for MsWord in HTML format 
----
Muldis-D-0.76.0
http://search.cpan.org/~duncand/Muldis-D-0.76.0/
Formal spec of Muldis D relational DBMS lang 
----
Net-OAuth-0.15
http://search.cpan.org/~kgrennan/Net-OAuth-0.15/
OAuth protocol support 
----
Net-Redmine-0.06
http://search.cpan.org/~gugod/Net-Redmine-0.06/
A mechanized-based programming API against redmine server. 
----
Object-Exercise-1.14
http://search.cpan.org/~lembark/Object-Exercise-1.14/
Generic execution & benchmark harness for method calls. 
----
Padre-Plugin-Ecliptic-0.08
http://search.cpan.org/~azawawi/Padre-Plugin-Ecliptic-0.08/
Padre plugin that provides Eclipse-like useful features 
----
Parse-Debian-PackageDesc-0.1
http://search.cpan.org/~opera/Parse-Debian-PackageDesc-0.1/
Parses Debian changes and source package files 
----
Pod-L10N-0.03_02
http://search.cpan.org/~argrath/Pod-L10N-0.03_02/
----
Rose-DBx-Object-Builder-0.03
http://search.cpan.org/~danny/Rose-DBx-Object-Builder-0.03/
Database Table Schema Generation for Rose::DB::Object 
----
Script-Carp-0.01
http://search.cpan.org/~ktat/Script-Carp-0.01/
provide some way to leave messages when script died 
----
Sub-Prototype-Util-0.09
http://search.cpan.org/~vpit/Sub-Prototype-Util-0.09/
Prototype-related utility routines. 
----
SystemPerl-1.321
http://search.cpan.org/~wsnyder/SystemPerl-1.321/
SystemPerl Language Extension to SystemC 
----
Test-Cukes-0.02
http://search.cpan.org/~gugod/Test-Cukes-0.02/
A BBD test tool inspired by Cucumber 
----
Text-RewriteRules-0.21
http://search.cpan.org/~ambs/Text-RewriteRules-0.21/
A system to rewrite text using regexp-based rules 
----
TheSchwartz-Moosified-0.05_002
http://search.cpan.org/~stash/TheSchwartz-Moosified-0.05_002/
TheSchwartz based on Moose! 
----
Thread-Cleanup-0.02
http://search.cpan.org/~vpit/Thread-Cleanup-0.02/
Hook thread destruction. 
----
WWW-MobileCarrierJP-0.33
http://search.cpan.org/~tokuhirom/WWW-MobileCarrierJP-0.33/
scrape mobile carrier information 
----
WWW-Virull-0.001
http://search.cpan.org/~johnd/WWW-Virull-0.001/
Remote api to Virull.com 
----
Win32-lglcd-0.02
http://search.cpan.org/~xlat/Win32-lglcd-0.02/
----
Win32-lglcd-0.02-fixed
http://search.cpan.org/~xlat/Win32-lglcd-0.02-fixed/
----
XML-Toolkit-0.06
http://search.cpan.org/~perigrin/XML-Toolkit-0.06/
A set of tools for dealing with XML with the Way of the Moose. 
----
indirect-0.14
http://search.cpan.org/~vpit/indirect-0.14/
Lexically warn about using the indirect object syntax. 
----
jmx4perl-0.15_5
http://search.cpan.org/~roland/jmx4perl-0.15_5/
JMX acccess tool 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


------------------------------

Date: Fri, 5 Jun 2009 08:06:28 +0100
From: "John" <john1949@yahoo.com>
Subject: Re: print buffer in Perl 5.10
Message-Id: <h0ag5a$uf5$1@news.albasani.net>


"Peter J. Holzer" <hjp-usenet2@hjp.at> wrote in message 
news:slrnh2gibj.hk2.hjp-usenet2@hrunkner.hjp.at...
> On 2009-06-04 09:44, John <john1949@yahoo.com> wrote:
>>
>> "Ben Morrow" <ben@morrow.me.uk> wrote in message
>> news:s6kif6-ir2.ln1@osiris.mauzo.dyndns.org...
>>>
>>> Quoth "John" <john1949@yahoo.com>:
>>>>
>>>> Moved from Etch to Lenny in Debian and from Perl 5.8.8 to 5.10.
>>>>
>>>> Normally I use:
>>>> our $old_fh=select(STDOUT); $|=1; select($old_fh); # Make standard 
>>>> output
>>>> socket hot
>>>> but this appears no longer to work and output is now buffered.
> [...]
>> The proram is embarrassingly small but I cannot stop the print buffer.
>
> [program snipped]
>
> Your program works fine on Debian Lenny. To test, invoke it like this:
>
> $ ./john | cat
>
> It will wait after each "<br>".
>
> hp
>

Thank you gentlemen

OK, I have run it from the command line and it is fine.  The program waits 
the required number of seconds and prints the next line.

But it does not work on a browser (IE6 IE7 and FF).

This probably (?) suggests Per 5.10 is OK and there is a setting in Apache2 
that is causing the output to buffer.

Is that how you now see it?

Regards
John




------------------------------

Date: Fri, 05 Jun 2009 11:51:30 +0800
From: jidanni@jidanni.org
Subject: Tell me the Flintstones HoH has 22 things
Message-Id: <874ouvs5h9.fsf@jidanni.org>

Regarding this hash of hashes on
$ man perldsc
%HoH = (
       flintstones => {
               lead      => "fred",
               pal       => "barney",
       },
       jetsons     => {
               lead      => "george",
               wife      => "jane",
               "his boy" => "elroy",
       },
       simpsons    => {
               lead      => "homer",
               wife      => "marge",
               kid       => "bart",
       },
);

What command will tell me what I want to know: that there are 22 things
inside it? The following docs didn't help. Does one really need to write
a recursive program to finally get a "22"? I'm willing to take 19 for an
answer too, but not 3, or "2/8".

$ perldoc -q entries
>Found in /usr/share/perl/5.10/pod/perlfaq4.pod
>  How can I know how many entries are in a hash?
>    If you mean how many keys
No I don't!!
>$ perldoc -f length
>  Note that this cannot be used on an entire array or hash to find out
>  how many elements these have. For that, use "scalar @array" and
>  "scalar keys %hash" respectively.
elements==keys?!


------------------------------

Date: Thu, 04 Jun 2009 23:12:00 -0500
From: Lawrence Statton <yankeeinexile@gmail.com>
Subject: Re: Tell me the Flintstones HoH has 22 things
Message-Id: <m1tz2vgvzj.fsf@mac.gateway.2wire.net>

jidanni@jidanni.org writes:
> Regarding this hash of hashes on
> $ man perldsc
> %HoH = (
>        flintstones => {
>                lead      => "fred",
>                pal       => "barney",
>        },
>        jetsons     => {
>                lead      => "george",
>                wife      => "jane",
>                "his boy" => "elroy",
>        },
>        simpsons    => {
>                lead      => "homer",
>                wife      => "marge",
>                kid       => "bart",
>        },
> );
>
> What command will tell me what I want to know: that there are 22 things
> inside it? The following docs didn't help. Does one really need to write
> a recursive program to finally get a "22"? I'm willing to take 19 for an
> answer too, but not 3, or "2/8".

Ummm ... the only anwers I can see would be "3" (there are three things
in %HoH) or 8 (there are eight leaves at the bottom of the tree.)

How you came to 22 is a bogglement ....

 --L


------------------------------

Date: Thu, 04 Jun 2009 21:12:02 -0700
From: sln@netherlands.com
Subject: Re: Tell me the Flintstones HoH has 22 things
Message-Id: <tn6h25t26o33kpngb6ga9ntg0564ol6cg0@4ax.com>

On Fri, 05 Jun 2009 11:51:30 +0800, jidanni@jidanni.org wrote:

>Regarding this hash of hashes on
>$ man perldsc
>%HoH = (
>       flintstones => {
>               lead      => "fred",
>               pal       => "barney",
>       },
>       jetsons     => {
>               lead      => "george",
>               wife      => "jane",
>               "his boy" => "elroy",
>       },
>       simpsons    => {
>               lead      => "homer",
>               wife      => "marge",
>               kid       => "bart",
>       },
>);
>
>What command will tell me what I want to know: that there are 22 things
>inside it? The following docs didn't help. Does one really need to write
>a recursive program to finally get a "22"?

yes

-sln


------------------------------

Date: Thu, 4 Jun 2009 21:16:42 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: Tell me the Flintstones HoH has 22 things
Message-Id: <bqimf6xhq8.ln2@goaway.wombat.san-francisco.ca.us>

On 2009-06-05, jidanni@jidanni.org <jidanni@jidanni.org> wrote:
> Regarding this hash of hashes on
> $ man perldsc
> %HoH = (
>        flintstones => {
>                lead      => "fred",
>                pal       => "barney",
>        },
>        jetsons     => {
>                lead      => "george",
>                wife      => "jane",
>                "his boy" => "elroy",
>        },
>        simpsons    => {
>                lead      => "homer",
>                wife      => "marge",
>                kid       => "bart",
>        },
> );
>
> What command will tell me what I want to know: that there are 22 things
> inside it? The following docs didn't help. Does one really need to write
> a recursive program to finally get a "22"? I'm willing to take 19 for an
> answer too, but not 3, or "2/8".

Yes, you really need to recurse down the structure.  It's probable that
something like this exists in CPAN already, though.  You might try
using Data::Walk:

http://search.cpan.org/~guido/Data-Walk-1.00/lib/Data/Walk.pm

> $ perldoc -q entries
>>Found in /usr/share/perl/5.10/pod/perlfaq4.pod
>>  How can I know how many entries are in a hash?
>>    If you mean how many keys
> No I don't!!
>>$ perldoc -f length
>>  Note that this cannot be used on an entire array or hash to find out
>>  how many elements these have. For that, use "scalar @array" and
>>  "scalar keys %hash" respectively.
> elements==keys?!

There is a one-to-one mapping between the keys of a hash and its values.
The above structure just happens to have hashrefs as the values of the
hash.  But scalar keys %hash doesn't know (or care) what the values are;
in fact, scalar values %hash would give you the same number (or at least
it should).

So yes, you need to recurse your structure if you want to know how many
actual scalar values (as opposed to references) are in your hash and its
substructures.

--keith

-- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information



------------------------------

Date: Fri, 05 Jun 2009 00:26:24 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: Tell me the Flintstones HoH has 22 things
Message-Id: <8763fbi9vz.fsf@quad.sysarch.com>

>>>>> "LS" == Lawrence Statton <yankeeinexile@gmail.com> writes:

  LS> jidanni@jidanni.org writes:
  >> Regarding this hash of hashes on
  >> $ man perldsc
  >> %HoH = (
  >> flintstones => {
  >> lead      => "fred",
  >> pal       => "barney",
  >> },
  >> jetsons     => {
  >> lead      => "george",
  >> wife      => "jane",
  >> "his boy" => "elroy",
  >> },
  >> simpsons    => {
  >> lead      => "homer",
  >> wife      => "marge",
  >> kid       => "bart",
  >> },
  >> );

  LS> How you came to 22 is a bogglement ....

there are 3 top level keys (or 6 things counting keys and values) and
then 8 second level keys (16 more things) for a total of 22. yes, it is
a very odd and useless number. and it is easily derived by counting keys
recursively and doubling that value. what use this has is beyond me.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


------------------------------

Date: Thu, 04 Jun 2009 21:56:44 -0700
From: sln@netherlands.com
Subject: Re: Tell me the Flintstones HoH has 22 things
Message-Id: <ta9h25h4sp25pfed6d0nhqa44q8s8c64hj@4ax.com>

On Thu, 04 Jun 2009 21:12:02 -0700, sln@netherlands.com wrote:

>On Fri, 05 Jun 2009 11:51:30 +0800, jidanni@jidanni.org wrote:
>
>>Regarding this hash of hashes on
>>$ man perldsc
>>%HoH = (
>>       flintstones => {
>>               lead      => "fred",
>>               pal       => "barney",
>>       },
>>       jetsons     => {
>>               lead      => "george",
>>               wife      => "jane",
>>               "his boy" => "elroy",
>>       },
>>       simpsons    => {
>>               lead      => "homer",
>>               wife      => "marge",
>>               kid       => "bart",
>>       },
>>);
>>
>>What command will tell me what I want to know: that there are 22 things
>>inside it? The following docs didn't help. Does one really need to write
>>a recursive program to finally get a "22"?
>
>yes
>
>-sln

The question is, can you write a 3-liner to do it?



------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 2460
***************************************


home help back first fref pref prev next nref lref last post