Sun751 has asked for the wisdom of the Perl Monks concerning the following question:

In my script I am using hash and hash reference, to make my out put up to the order I tried to use Tie::Hash But i am getting Warning, and I don;t understand why if any one can suggest me, Please here is my code,
use strict; use warnings; use Tie::Hash; my (%resource,%wnt,%unx,%component); my ($os,$informix,$oracle,$sql); tie %resource, 'Tie::Hash'; tie %wnt, 'Tie::Hash'; tie %unx, 'Tie::Hash'; tie %component, 'Tie::Hash'; inspect(\$os,\$informix,\$oracle,\$sql); initialize(\%resource,\%wnt,\%unx,\%component,$config_file); consolidate(\%resource,\%wnt,\%unx,\%component,$informix,$oracle,$sql) +; dispatch(\%resource,\%wnt,\%unx,\%component,$os);
Cheers!

Replies are listed 'Best First'.
Re: Hash Tie
by BrowserUk (Patriarch) on Jun 26, 2009 at 08:32 UTC
    But i am getting Warning,

    Sorry to bother you an' all, but if it's not imposing too much upon your valuable time, could you give us a hint as to which warning(s) you are getting?

    Thanks awfully :)


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      I suspect Sun751 is getting WARNING: calling Tie::Hash->new since Tie::Hash->TIEHASH is missing

        Yes. I got that too.

        But my hope was that by engaging the OP in polite discourse we might elucidate why he is tying his hashes. That is, what he is hoping to achieve by doing so.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Hash Tie
by davorg (Chancellor) on Jun 26, 2009 at 08:54 UTC
Re: Hash Tie
by Anonymous Monk on Jun 26, 2009 at 08:46 UTC
    Why are you using Tie::Hash? It is a base class, a skeleton, it does nothing.
Re: Hash Tie
by Marshall (Canon) on Jun 27, 2009 at 08:39 UTC
    I am going to be less polite than the previous posters. Your code makes no sense or at least it doesn't make sense to me. What are you trying to do? Can you describe what you want in words?

    consolidate(\%resource,\%wnt,\%unx,\%component,$informix,$oracle,$sql)) WHEW! 4 hash refs and then 3 scalars! Flat out, you have the wrong data structure. This is not right.

    sorry that I was impolite. Let me help you work on how to get a better data structure...I do suggest writing some paragraphs in words that describe what you want to accomplish.

      Hi,
      resource, wnt, unx and component are three hash which I am using to read data from (my config file). Where as informix, oracle and sql are three variable which I am using to check which database I am using.
      Basically I want to keep the originality so I want to use Hash Tie, after checking few data I am writing all hash creating new file using file handle.
      And the warning I am getting is,

      WARNING: calling Tie::Hash->new since Tie::Hash->TIEHASH is missing at generate_xcf.pl line 35"
      Line 53 means this line in above code, 35 tie %resource,'Tie::Hash'; 36 tie %wnt,'Tie::Hash'; 37 tie %unx,'Tie::Hash'; 38 tie %component,'Tie::Hash';
      hope you got me, looking forward for suggestion. Cheers!!!


      Hurray!!! found the solution!!! add Ix in front of hash,
      35 tie %resource,'Tie::IxHash'; 36 tie %wnt,'Tie::IxHash'; 37 tie %unx,'Tie::IxHash'; 38 tie %component,'Tie::IxHash';
      Any way thanks, Cheers
Re: Hash Tie
by Marshall (Canon) on Jun 27, 2009 at 08:32 UTC
    I am going to be less polite than the previous posters. Your code makes no sense or at least it doesn't make sense to me. What are you trying to do? Can you describe what you want in words? See next post.