[26194] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8383 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 2 09:05:42 2005

Date: Fri, 2 Sep 2005 06:05:08 -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, 2 Sep 2005     Volume: 10 Number: 8383

Today's topics:
    Re: Disappearing Module (Anno Siegel)
    Re: Disappearing Module <hal@thresholddigital.com>
    Re: My Net::eBay PERL module now recommended by eBay it <bertha@yetta.net>
    Re: Padding Problem UPDATE (Still broken) (sgillett)
    Re: Padding Problem UPDATE (Still broken) <hal@thresholddigital.com>
        Posting Guidelines for comp.lang.perl.misc ($Revision:  tadmc@augustmail.com
    Re: values of hash of hash (Anno Siegel)
        What is the better method for using hash?? <sonet.all@msa.hinet.net>
    Re: What is the better method for using hash?? <noreply@gunnar.cc>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 2 Sep 2005 08:42:54 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Disappearing Module
Message-Id: <df93ae$6ho$1@mamenchi.zrz.TU-Berlin.DE>

Hal Vaughan  <hal@thresholddigital.com> wrote in comp.lang.perl.misc:
> I've had a similar problem before and now I realize it was resolved by
> removing a level of modules.  I don't see how I can include sample code
> unless I include entire modules, but basically, when I do a "use Module;",
> in some cases the functions in that Module aren't available.  Here's an
> example that works:
> 
> #!/usr/bin/perl
> #Program: t-test
> 
>         use MyMods::Log;
> 
> ....
> 
>         initlog($channel);      #This initializes the Log functions
> 
> Then, in MyMods/Log.pm, I have:
> 
>         use MyMods::Channel;
> 
> sub initlog {
>         my $channel = shift(@_);
>         setchannelprogram($channel);    #Routine in MyMods::Channel -- 
>                                         #  used w/out problem
>         return;
> }
> 
> When I do this, it works just fine.

I doubt that.  MyMods/Log.pm doesn't return a true value, Perl
will not accept it.

> However, when I add another level, by
> having a program use a module that uses MyMods::Log, then MyMod::Log cannot
> access routines in MyMods::Channel.  Here's an example of what does not
> work:

Oh man!  Would you please be so kind and explain *what* doesn't work?
What error message do you get?

> #!/usr/bin/perl
> #Program: t-fetch
> 
>         use MyMods::Search;
> 
> .....
>         initsearch($channel);   #This initializes Search
> 
> Then, in MyMods/Search.pm, I have:
> 
>         use MyMods::Log;
> 
> ...
> 
> sub initsearch {
>         my $channel = shift(@_);
>         initlog($channel);      #Same initchannel as before, but now
>                                 #called by a function in a module, not
>                                 #directly from the main program
>         return;
> }
> 
> Then, in MyMods/Log.pm, again, I have the same as before:
> 
>         use MyMods::Channel;
> 
> sub initlog {
>         my $channel = shift(@_);
>         setchannelprogram($channel);    #Routine in MyMods::Channel -- 
>                                         #  Now won't work when called from a mod
>                                         #  that is, in turn, called from a mod
>         return;
> }

None of your modules returns a true value.  The module MyMod/Channel.pm
is missing.

I have reconstructed your setup.  After adding the missing return values
and providing MyMod/Channel.pm

    sub setchannelprogram {
        print "setchannelprogram( $_[ 0])\n";
    }

    1;

things work exactly as expected:  Top level calls initsearch(), which
calls initlog(), which calls setchannelprogram().  Since your presented
code is incomplete, I have probably fixed something you didn't show.

Result:  I spent about 20 minutes trying to find out wtf you are
complaining about and came up empty.  Frustration for me, no help
for you.

Now please show the exact and complete code that is giving you trouble,
and include the error message you're getting.

Anno
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


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

Date: Fri, 02 Sep 2005 08:47:24 -0400
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Re: Disappearing Module
Message-Id: <M7-dnZ2dnZ11IHSvnZ2dnUDUhd6dnZ2dRVn-y52dnZ0@comcast.com>

Anno Siegel wrote:

> Hal Vaughan  <hal@thresholddigital.com> wrote in comp.lang.perl.misc:
>> I've had a similar problem before and now I realize it was resolved by
>> removing a level of modules.  I don't see how I can include sample code
>> unless I include entire modules, but basically, when I do a "use
>> Module;",
>> in some cases the functions in that Module aren't available.  Here's an
>> example that works:
>> 
>> #!/usr/bin/perl
>> #Program: t-test
>> 
>>         use MyMods::Log;
>> 
>> ....
>> 
>>         initlog($channel);      #This initializes the Log functions
>> 
>> Then, in MyMods/Log.pm, I have:
>> 
>>         use MyMods::Channel;
>> 
>> sub initlog {
>>         my $channel = shift(@_);
>>         setchannelprogram($channel);    #Routine in MyMods::Channel --
>>                                         #  used w/out problem
>>         return;
>> }
>> 
>> When I do this, it works just fine.
> 
> I doubt that.  MyMods/Log.pm doesn't return a true value, Perl
> will not accept it.

Sorry.  I was so focused on the "use" statements and the beginning I forgot
to include that all modules end with "1;" as the last line, so it does work
fine without error messages.

>> However, when I add another level, by
>> having a program use a module that uses MyMods::Log, then MyMod::Log
>> cannot
>> access routines in MyMods::Channel.  Here's an example of what does not
>> work:
> 
> Oh man!  Would you please be so kind and explain *what* doesn't work?
> What error message do you get?

Undefined subroutine &MyMods::Log::setchannelprogram called at MyMods/Log.pm
line 150.

>> #!/usr/bin/perl
>> #Program: t-fetch
>> 
>>         use MyMods::Search;
>> 
>> .....
>>         initsearch($channel);   #This initializes Search
>> 
>> Then, in MyMods/Search.pm, I have:
>> 
>>         use MyMods::Log;
>> 
>> ...
>> 
>> sub initsearch {
>>         my $channel = shift(@_);
>>         initlog($channel);      #Same initchannel as before, but now
>>                                 #called by a function in a module, not
>>                                 #directly from the main program
>>         return;
>> }
>> 
>> Then, in MyMods/Log.pm, again, I have the same as before:
>> 
>>         use MyMods::Channel;
>> 
>> sub initlog {
>>         my $channel = shift(@_);
>>         setchannelprogram($channel);    #Routine in MyMods::Channel --
>>                                         #  Now won't work when called
>>                                         #  from a mod that is, in turn,
>>                                         #  called from a mod
>>         return;
>> }
> 
> None of your modules returns a true value.  The module MyMod/Channel.pm
> is missing.
> 
> I have reconstructed your setup.  After adding the missing return values
> and providing MyMod/Channel.pm
> 
>     sub setchannelprogram {
>         print "setchannelprogram( $_[ 0])\n";
>     }
> 
>     1;
> 
> things work exactly as expected:  Top level calls initsearch(), which
> calls initlog(), which calls setchannelprogram().  Since your presented
> code is incomplete, I have probably fixed something you didn't show.
> 
> Result:  I spent about 20 minutes trying to find out wtf you are
> complaining about and came up empty.  Frustration for me, no help
> for you.
> 
> Now please show the exact and complete code that is giving you trouble,
> and include the error message you're getting.

Each module is about 500 lines.  I am not clear on just how much to include. 
I've read up on Exporter, as another response suggested, but it seems to me
there is nothing there to help.  I've gone through and not only re-typed
the module and function names, but actually copied the names from the
Channel.pm file into the Log.pm file.  (I have a learning disability, which
makes it almost impossible to spot misspellings without them being
highlighted by syntax highlighting, so I went through carefully to make
sure that was not the problem -- at least it wasn't in any obvious way I
could understand.  I also don't see how it could be a problem when both
modules work fine in one program.)  I'm 100% self taught, so while I try to
go by what FAQs and other guides say, there are often "obvious" areas that
I have missed because I just never read a particular topic.  I've been
hoping that, in this case, there might have been some rule about module use
that was so obvious and clear that while I missed it, most people would see
what I'm not doing.

I can post more, but, as I said, without posting the entire program and
hundreds of lines in each module, I'm not sure just how much to post.

Hal

> Anno



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

Date: 2 Sep 2005 12:29:56 GMT
From: Bertha <bertha@yetta.net>
Subject: Re: My Net::eBay PERL module now recommended by eBay itself
Message-Id: <slrndhgcr7.qsh.bertha@yetta.net>

On Fri, 02 Sep 2005 03:24:28 GMT, Ignoramus12789 
<ignoramus12789@NOSPAM.12789.invalid> muttered something like:

> The Perl::eBay module that I wrote a few days ago, is now recommended
> by ebay:
> 
> http://developer.ebay.com/php/

Hey, cool!  Remember all the little people when you're rich and famous.  
:)

-Bertha
-- 
Tongue-tied and twisted, just an earthbound misfit, I!


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

Date: Fri, 02 Sep 2005 10:29:00 GMT
From: steven_p_gillett_at_yahoo_dot_co_dot_uk@foo.com (sgillett)
Subject: Re: Padding Problem UPDATE (Still broken)
Message-Id: <MPVRe.78705$c95.64888@fe11.news.easynews.com>

Hal,

I am having a similar problem where I am able to decrypt using perl but
not java and wondered if you could help?

With perl I am using:
my $cipher = Crypt::CBC->new($keyword, 'Blowfish');
my $decrypted = $cipher->decrypt($string);

With java I am using:
Cipher cipher = Cipher.getInstance("Blowfish/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
byte[] decrypted = cipher.doFinal(string);

but get the following error:
javax.crypto.BadPaddingException: Given final block not properly padded

Please can you let me know how you got it working?

Thanks for any help,

Steve.

-------------------------------------
Hal Vaughan wrote:




> Jim,

> Encryption is not something I understand or do well.  Your answers were
> not
> only helpful, but your sources were good ones for me to learn from.

> Between your post and the sources you cited, I was able to take care of
> several tweaks and get everything working.

> Hal







##-----------------------------------------------##
Article posted with Web Developer's USENET Archive
http://www.1-script.com/forums
no-spam read and post WWW interface to your favorite newsgroup - 
comp.lang.perl.misc - 36524 messages and counting!
##-----------------------------------------------##


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

Date: Fri, 02 Sep 2005 09:04:39 -0400
From: Hal Vaughan <hal@thresholddigital.com>
Subject: Re: Padding Problem UPDATE (Still broken)
Message-Id: <Z9adnfG0HL110IXeRVn-pg@comcast.com>

sgillett wrote:

> Hal,
> 
> I am having a similar problem where I am able to decrypt using perl but
> not java and wondered if you could help?
> 
> With perl I am using:
> my $cipher = Crypt::CBC->new($keyword, 'Blowfish');
> my $decrypted = $cipher->decrypt($string);

First I have to add that, like I said in my first post, I have very little
idea what I'm doing with cryptography.  I did a search to find an example
of someone sending data back and forth from Perl to Java (and back again),
and basically copied what they did.  (That's why I used Blowfish -- I
really have no idea exactly how Blowfish works, but when I did a search on
it, I felt I had every reason to trust it as much as almost anything.  I
still hope, someday, to change it to PGP.)

With that having been said, I noticed that you're not setting the padding in
Perl.  I'd suggest going back through this thread (use Google Groups if
you're server has expired the earlier articles), and see what I have in my
first posts.  That might help.

Hal

> With java I am using:
> Cipher cipher = Cipher.getInstance("Blowfish/CBC/PKCS5Padding");
> cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
> byte[] decrypted = cipher.doFinal(string);
> 
> but get the following error:
> javax.crypto.BadPaddingException: Given final block not properly padded
> 
> Please can you let me know how you got it working?
> 
> Thanks for any help,
> 
> Steve.
> 
> -------------------------------------
> Hal Vaughan wrote:
> 
> 
> 
> 
>> Jim,
> 
>> Encryption is not something I understand or do well.  Your answers were
>> not
>> only helpful, but your sources were good ones for me to learn from.
> 
>> Between your post and the sources you cited, I was able to take care of
>> several tweaks and get everything working.
> 
>> Hal
> 
> 
> 
> 
> 
> 
> 
> ##-----------------------------------------------##
> Article posted with Web Developer's USENET Archive
> http://www.1-script.com/forums
> no-spam read and post WWW interface to your favorite newsgroup -
> comp.lang.perl.misc - 36524 messages and counting!
> ##-----------------------------------------------##



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

Date: 02 Sep 2005 07:22:41 GMT
From: tadmc@augustmail.com
Subject: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
Message-Id: <4317fdbb$0$4862$8b463f8a@news.nationwide.net>

Outline
   Before posting to comp.lang.perl.misc
      Must
       - Check the Perl Frequently Asked Questions (FAQ)
       - Check the other standard Perl docs (*.pod)
      Really Really Should
       - Lurk for a while before posting
       - Search a Usenet archive
      If You Like
       - Check Other Resources
   Posting to comp.lang.perl.misc
      Is there a better place to ask your question?
       - Question should be about Perl, not about the application area
      How to participate (post) in the clpmisc community
       - Carefully choose the contents of your Subject header
       - Use an effective followup style
       - Speak Perl rather than English, when possible
       - Ask perl to help you
       - Do not re-type Perl code
       - Provide enough information
       - Do not provide too much information
       - Do not post binaries, HTML, or MIME
      Social faux pas to avoid
       - Asking a Frequently Asked Question
       - Asking a question easily answered by a cursory doc search
       - Asking for emailed answers
       - Beware of saying "doesn't work"
       - Sending a "stealth" Cc copy
      Be extra cautious when you get upset
       - Count to ten before composing a followup when you are upset
       - Count to ten after composing and before posting when you are upset
-----------------------------------------------------------------

Posting Guidelines for comp.lang.perl.misc ($Revision: 1.5 $)
    This newsgroup, commonly called clpmisc, is a technical newsgroup
    intended to be used for discussion of Perl related issues (except job
    postings), whether it be comments or questions.

    As you would expect, clpmisc discussions are usually very technical in
    nature and there are conventions for conduct in technical newsgroups
    going somewhat beyond those in non-technical newsgroups.

    The article at:

        http://www.catb.org/~esr/faqs/smart-questions.html

    describes how to get answers from technical people in general.

    This article describes things that you should, and should not, do to
    increase your chances of getting an answer to your Perl question. It is
    available in POD, HTML and plain text formats at:

     http://mail.augustmail.com/~tadmc/clpmisc.shtml

    For more information about netiquette in general, see the "Netiquette
    Guidelines" at:

     http://andrew2.andrew.cmu.edu/rfc/rfc1855.html

    A note to newsgroup "regulars":

       Do not use these guidelines as a "license to flame" or other
       meanness. It is possible that a poster is unaware of things
       discussed here.  Give them the benefit of the doubt, and just
       help them learn how to post, rather than assume 

    A note about technical terms used here:

       In this document, we use words like "must" and "should" as
       they're used in technical conversation (such as you will
       encounter in this newsgroup). When we say that you *must* do
       something, we mean that if you don't do that something, then
       it's unlikely that you will benefit much from this group.
       We're not bossing you around; we're making the point without
       lots of words.

    Do *NOT* send email to the maintainer of these guidelines. It will be
    discarded unread. The guidelines belong to the newsgroup so all
    discussion should appear in the newsgroup. I am just the secretary that
    writes down the consensus of the group.

Before posting to comp.lang.perl.misc
  Must
    This section describes things that you *must* do before posting to
    clpmisc, in order to maximize your chances of getting meaningful replies
    to your inquiry and to avoid getting flamed for being lazy and trying to
    have others do your work.

    The perl distribution includes documentation that is copied to your hard
    drive when you install perl. Also installed is a program for looking
    things up in that (and other) documentation named 'perldoc'.

    You should either find out where the docs got installed on your system,
    or use perldoc to find them for you. Type "perldoc perldoc" to learn how
    to use perldoc itself. Type "perldoc perl" to start reading Perl's
    standard documentation.

    Check the Perl Frequently Asked Questions (FAQ)
        Checking the FAQ before posting is required in Big 8 newsgroups in
        general, there is nothing clpmisc-specific about this requirement.
        You are expected to do this in nearly all newsgroups.

        You can use the "-q" switch with perldoc to do a word search of the
        questions in the Perl FAQs.

    Check the other standard Perl docs (*.pod)
        The perl distribution comes with much more documentation than is
        available for most other newsgroups, so in clpmisc you should also
        see if you can find an answer in the other (non-FAQ) standard docs
        before posting.

    It is *not* required, or even expected, that you actually *read* all of
    Perl's standard docs, only that you spend a few minutes searching them
    before posting.

    Try doing a word-search in the standard docs for some words/phrases
    taken from your problem statement or from your very carefully worded
    "Subject:" header.

  Really Really Should
    This section describes things that you *really should* do before posting
    to clpmisc.

    Lurk for a while before posting
        This is very important and expected in all newsgroups. Lurking means
        to monitor a newsgroup for a period to become familiar with local
        customs. Each newsgroup has specific customs and rituals. Knowing
        these before you participate will help avoid embarrassing social
        situations. Consider yourself to be a foreigner at first!

    Search a Usenet archive
        There are tens of thousands of Perl programmers. It is very likely
        that your question has already been asked (and answered). See if you
        can find where it has already been answered.

        One such searchable archive is:

         http://groups.google.com/advanced_group_search

  If You Like
    This section describes things that you *can* do before posting to
    clpmisc.

    Check Other Resources
        You may want to check in books or on web sites to see if you can
        find the answer to your question.

        But you need to consider the source of such information: there are a
        lot of very poor Perl books and web sites, and several good ones
        too, of course.

Posting to comp.lang.perl.misc
    There can be 200 messages in clpmisc in a single day. Nobody is going to
    read every article. They must decide somehow which articles they are
    going to read, and which they will skip.

    Your post is in competition with 199 other posts. You need to "win"
    before a person who can help you will even read your question.

    These sections describe how you can help keep your article from being
    one of the "skipped" ones.

  Is there a better place to ask your question?
    Question should be about Perl, not about the application area
        It can be difficult to separate out where your problem really is,
        but you should make a conscious effort to post to the most
        applicable newsgroup. That is, after all, where you are the most
        likely to find the people who know how to answer your question.

        Being able to "partition" a problem is an essential skill for
        effectively troubleshooting programming problems. If you don't get
        that right, you end up looking for answers in the wrong places.

        It should be understood that you may not know that the root of your
        problem is not Perl-related (the two most frequent ones are CGI and
        Operating System related), so off-topic postings will happen from
        time to time. Be gracious when someone helps you find a better place
        to ask your question by pointing you to a more applicable newsgroup.

  How to participate (post) in the clpmisc community
    Carefully choose the contents of your Subject header
        You have 40 precious characters of Subject to win out and be one of
        the posts that gets read. Don't waste them. Take care while
        composing them, they are the key that opens the door to getting an
        answer.

        Spend them indicating what aspect of Perl others will find if they
        should decide to read your article.

        Do not spend them indicating "experience level" (guru, newbie...).

        Do not spend them pleading (please read, urgent, help!...).

        Do not spend them on non-Subjects (Perl question, one-word
        Subject...)

        For more information on choosing a Subject see "Choosing Good
        Subject Lines":

         http://www.cpan.org/authors/id/D/DM/DMR/subjects.post

        Part of the beauty of newsgroup dynamics, is that you can contribute
        to the community with your very first post! If your choice of
        Subject leads a fellow Perler to find the thread you are starting,
        then even asking a question helps us all.

    Use an effective followup style
        When composing a followup, quote only enough text to establish the
        context for the comments that you will add. Always indicate who
        wrote the quoted material. Never quote an entire article. Never
        quote a .signature (unless that is what you are commenting on).

        Intersperse your comments *following* each section of quoted text to
        which they relate. Unappreciated followup styles are referred to as
        "top-posting", "Jeopardy" (because the answer comes before the
        question), or "TOFU" (Text Over, Fullquote Under).

        Reversing the chronology of the dialog makes it much harder to
        understand (some folks won't even read it if written in that style).
        For more information on quoting style, see:

         http://web.presby.edu/~nnqadmin/nnq/nquote.html

    Speak Perl rather than English, when possible
        Perl is much more precise than natural language. Saying it in Perl
        instead will avoid misunderstanding your question or problem.

        Do not say: I have variable with "foo\tbar" in it.

        Instead say: I have $var = "foo\tbar", or I have $var = 'foo\tbar',
        or I have $var = <DATA> (and show the data line).

    Ask perl to help you
        You can ask perl itself to help you find common programming mistakes
        by doing two things: enable warnings (perldoc warnings) and enable
        "strict"ures (perldoc strict).

        You should not bother the hundreds/thousands of readers of the
        newsgroup without first seeing if a machine can help you find your
        problem. It is demeaning to be asked to do the work of a machine. It
        will annoy the readers of your article.

        You can look up any of the messages that perl might issue to find
        out what the message means and how to resolve the potential mistake
        (perldoc perldiag). If you would like perl to look them up for you,
        you can put "use diagnostics;" near the top of your program.

    Do not re-type Perl code
        Use copy/paste or your editor's "import" function rather than
        attempting to type in your code. If you make a typo you will get
        followups about your typos instead of about the question you are
        trying to get answered.

    Provide enough information
        If you do the things in this item, you will have an Extremely Good
        chance of getting people to try and help you with your problem!
        These features are a really big bonus toward your question winning
        out over all of the other posts that you are competing with.

        First make a short (less than 20-30 lines) and *complete* program
        that illustrates the problem you are having. People should be able
        to run your program by copy/pasting the code from your article. (You
        will find that doing this step very often reveals your problem
        directly. Leading to an answer much more quickly and reliably than
        posting to Usenet.)

        Describe *precisely* the input to your program. Also provide example
        input data for your program. If you need to show file input, use the
        __DATA__ token (perldata.pod) to provide the file contents inside of
        your Perl program.

        Show the output (including the verbatim text of any messages) of
        your program.

        Describe how you want the output to be different from what you are
        getting.

        If you have no idea at all of how to code up your situation, be sure
        to at least describe the 2 things that you *do* know: input and
        desired output.

    Do not provide too much information
        Do not just post your entire program for debugging. Most especially
        do not post someone *else's* entire program.

    Do not post binaries, HTML, or MIME
        clpmisc is a text only newsgroup. If you have images or binaries
        that explain your question, put them in a publically accessible
        place (like a Web server) and provide a pointer to that location. If
        you include code, cut and paste it directly in the message body.
        Don't attach anything to the message. Don't post vcards or HTML.
        Many people (and even some Usenet servers) will automatically filter
        out such messages. Many people will not be able to easily read your
        post. Plain text is something everyone can read.

  Social faux pas to avoid
    The first two below are symptoms of lots of FAQ asking here in clpmisc.
    It happens so often that folks will assume that it is happening yet
    again. If you have looked but not found, or found but didn't understand
    the docs, say so in your article.

    Asking a Frequently Asked Question
        It should be understood that you may have missed the applicable FAQ
        when you checked, which is not a big deal. But if the Frequently
        Asked Question is worded similar to your question, folks will assume
        that you did not look at all. Don't become indignant at pointers to
        the FAQ, particularly if it solves your problem.

    Asking a question easily answered by a cursory doc search
        If folks think you have not even tried the obvious step of reading
        the docs applicable to your problem, they are likely to become
        annoyed.

        If you are flamed for not checking when you *did* check, then just
        shrug it off (and take the answer that you got).

    Asking for emailed answers
        Emailed answers benefit one person. Posted answers benefit the
        entire community. If folks can take the time to answer your
        question, then you can take the time to go get the answer in the
        same place where you asked the question.

        It is OK to ask for a *copy* of the answer to be emailed, but many
        will ignore such requests anyway. If you munge your address, you
        should never expect (or ask) to get email in response to a Usenet
        post.

        Ask the question here, get the answer here (maybe).

    Beware of saying "doesn't work"
        This is a "red flag" phrase. If you find yourself writing that,
        pause and see if you can't describe what is not working without
        saying "doesn't work". That is, describe how it is not what you
        want.

    Sending a "stealth" Cc copy
        A "stealth Cc" is when you both email and post a reply without
        indicating *in the body* that you are doing so.

  Be extra cautious when you get upset
    Count to ten before composing a followup when you are upset
        This is recommended in all Usenet newsgroups. Here in clpmisc, most
        flaming sub-threads are not about any feature of Perl at all! They
        are most often for what was seen as a breach of netiquette. If you
        have lurked for a bit, then you will know what is expected and won't
        make such posts in the first place.

        But if you get upset, wait a while before writing your followup. I
        recommend waiting at least 30 minutes.

    Count to ten after composing and before posting when you are upset
        After you have written your followup, wait *another* 30 minutes
        before committing yourself by posting it. You cannot take it back
        once it has been said.

AUTHOR
    Tad McClellan <tadmc@augustmail.com> and many others on the
    comp.lang.perl.misc newsgroup.



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

Date: 2 Sep 2005 10:43:18 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: values of hash of hash
Message-Id: <df9ac6$ar4$1@mamenchi.zrz.TU-Berlin.DE>

ngoc  <ngoc@yahoo.com> wrote in comp.lang.perl.misc:

[Top-posting rearranged]

> xhoster@gmail.com wrote:
> > ngoc <ngoc@yahoo.com> wrote:
> > 
> >>I have
> >>$hash{1}{2}{3} = 7;
> >>$hash{1}{4}{5} = 6;
> >>I want to get 7 and 6 without using three for loop and keys function
> >>How can I do it?
> > 
> > 
> > Have you considered not creating the uselessly nested hashes in the first
> > place, but rather sticking the data into a more appropriate structure?

> Yes. I have considered it. My data is really complex. Each project have 
> many employees, each employee have many tasks, each task have time, 
> budget etc... This can be model as 3 level hash as I did.
> 
> For another reason, 3 nested for loop is not beautiful programming. I 
> try to avoid.

Where did you get that from?  If your data structure requires three
nested loops, write three nested loops.  If it requires five, use five.

Programming style is no set of hard and fast rules, like nesting
two deep is okay, three deep isn't.  The main criterion is impact
on readability.  A straight nest of loops of the same type, with
no intervening peculiarities on some levels, is perfectly readable
and should be used where appropriate as long as line length allows.

Anno
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


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

Date: Fri, 2 Sep 2005 19:38:21 +0800
From: "sonet" <sonet.all@msa.hinet.net>
Subject: What is the better method for using hash??
Message-Id: <df9djm$5rf$1@netnews.hinet.net>

How to compare the memory usage??What is the better??

(A)
hash1{TYPE1}{VALUE1}='A';
hash1{TYPE1}{VALUE2}='B';
hash1{TYPE1}{VALUE3}='C';
hash1{TYPE2}{VALUE1}='1';

or
(B)
TYPE1{VALUE1}='A';
TYPE1{VALUE2}='B';
TYPE1{VALUE2}='C';
TYPE2{VALUE1}='1';

How can i do that (A) hash keys as refs?




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

Date: Fri, 02 Sep 2005 14:41:24 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: What is the better method for using hash??
Message-Id: <3nqvjkF2pa01U1@individual.net>

sonet wrote:
> How to compare the memory usage??What is the better??
> 
> (A)
> hash1{TYPE1}{VALUE1}='A';
> hash1{TYPE1}{VALUE2}='B';
> hash1{TYPE1}{VALUE3}='C';
> hash1{TYPE2}{VALUE1}='1';
> 
> or
> (B)
> TYPE1{VALUE1}='A';
> TYPE1{VALUE2}='B';
> TYPE1{VALUE2}='C';
> TYPE2{VALUE1}='1';
> 
> How can i do that (A) hash keys as refs?

     perldoc perlreftut
     perldoc perlref

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


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

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 V10 Issue 8383
***************************************


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