I removed use strict because of the error message:
Can't use string ("Entering sub main::do_something ") as a HASH ref while "strict refs" in use at /home/sho/perl/dev//Log +Messages.pm line 43.
Thats not a good thing to do, and not an excuse to do it at all.

So now the problem is that in sub log_message my $self actually contains the string "Entering sub main::do_something\n". I believe that my
41 $self=shift
should put the class name in $self. I am referring to what I learnt here: A simple example OO script for total beginners.
Maybe my understanding of the concept is wrong.

Now how do I get the hash value of $self->{logfile} from sub log_message?

In reply to Re^4: Using an attribute function from a .pm file. by shobhit
in thread Using an attribute function from a .pm file. by shobhit

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.