On 09/23/2017 12:05 AM, Brent Laabs wrote:
OK, a method is something you call on an object, using a the dot operator.  A subroutine is an independent object installed into your current lexical scope.

If write was a sub, it would work exactly as you described:
    48:   my $Handle = open( $DateFile, :rw )
    53:   write( $Handle, $OldDateTime );
And if you wanted to, you could even refer to it by name...
   my $func = &write;
   $func( $Handle, $DateThing );

But it's not a sub, so it needs to be invoked on the object:
    53:   $Handle.write($OldDateTime );
- or -
    67:   $Handle.write: $DateTime;

Hi Brent,

Now I am confused.

I thought that when you wrote
    $x.AA.BB.CC

What you were doing was passing the result of AA($x)
to BB and its result to CC

Sort of like
    CC( BB( AA ($x) ) )

Only a heck of a lot easier to read,

Now I am not so sure.

When you say
   $Handle.write( $OldDateTime );

"write" is an object" not a sub.  By chance does this
apply to both objects AND subs?

And does
    $Handle.write: $DateTime;

also apply to subs?

-T

Reply via email to