Thank you very much for your help. It was a typo in my code that I had written "print" instead of "printf". I succeeded in reading the packages in the current directory where my script is.

However, I am running this case on a Cygwin platform and Perl interpreter cannot find the packages residing other than current directories although I declare them even within @INC. The directory of the said Perl script resides in
/home/UTKU/devel/my_script
The said packages are located in
/home/UTKU/devel/my_script/dir_one/my_package.pm /home/UTKU/devel/my_script/dir_two/my_package.pm
Now the script tries following:
#!/usr/bin/perl -w BEGIN { push @INC, "/home/UTKU/devel/my_script" } use Data::Dumper; use dir_two::my_package; print Dumper(\%my_hash);
Perl interpreter says me that my_hash is used only once, ie. it seems that the package has not been bound:
$ ./my_script.pl Name "main::my_hash" used only once: possible typo at ./my_script.pl l +ine 9. $VAR1 = {};
I know, interpreter takes the current directory into @INC but it also does not work. Can't I define packages with relative paths? The content of the package in /home/UTKU/devel/my_script/dir_two/my_package.pm is like in my first posting:
##! /usr/local/bin/perl package my_package; require(Exporter); @ISA = qw(Exporter); @EXPORT = qw( %my_hash ); %my_hash = ( ... );
Is there any mechanism to switch on verbose messages during compilation/elaboration/linkage time of the interpreter to see what it is doing with the packages?

In reply to Re^2: access to hashes with same name, from different packages with same name by utku
in thread access to hashes with same name, from different packages with same name by utku

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.