Hi, and many thanks (with a belated Merry Xmas) for the reply. Wish to address it in point form:

1. Using strictures: I did use those strictures (written outside the braces for the package MyDate). My bad for not reproducing it.. So I don't think its about any error being generated because i didn't declare those strictures. Using print rather than say didn't make any difference either.

2. Coderefs: I'm not quite sure what you mean by me not assigning a coderef? I defined the subroutines within my if statements.. so if $method was 'day' wouldn't &$method be calling &day? I did get the desired outputs from the subroutines.. so it seems to me like that wasn't a problem either.

3. Defining subs: I was learning AUTOLOAD (from Intermediate Perl) in the context of dynamically defining new subroutines, while your code only returns the desired value. I presume that means that if I write

say( Foo->day ); say( Foo->month ); say( Foo->day );

I would expect the output

Foo::day was called 26 Foo::month was called 12 26

rather than the actual output

Foo::day was called 26 Foo::month was called 12 Foo::day was called 26

Actually I get the impression that AUTOLOAD isn't even being called. Changing the words in my grep statement or writing if ( $method eq "dayz") {...} doesn't produce any errors while changing the name of my subroutine does. So erm...:S why?


In reply to Re^2: say statements within 'sub AUTOLOAD' by ianyappy
in thread say statements within 'sub AUTOLOAD' by ianyappy

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.