On Sat, Sep 23, 2017 at 8:19 AM, ToddAndMargo <toddandma...@zoho.com <mailto:toddandma...@zoho.com>> wrote:

    On 09/22/2017 11:09 PM, ToddAndMargo wrote:

        Hi All,

        https://docs.perl6.org/routine/write
        <https://docs.perl6.org/routine/write>

                (IO::Handle) method write
                Defined as:
                method write(IO::Handle:D: Blob:D $buf --> True)

                Writes $buf to the filehandle. This method can be called
                even when the handle is not in binary mode.



        This:
             48:   my $Handle = open( $DateFile, :rw )
             53:   write( $Handle, $OldDateTime );
             67:   write( $Handle, $DateTime );

        gives me this:
             Undeclared routine: write used at lines 53, 67

        Huh?  Seems to me I am follow the directions.  What am
        I doing wrong?


        Many thanks,
        -T



    This worked:
         $Handle.print( "$DateTime\n" );

    But I still what to know what was wrong with the
    way I interpreted the manual

    -T

On 09/22/2017 11:25 PM, Fernando Santagata wrote:
Hi,

"write" is a method; its signature is

method write(IO::Handle:D: Blob:D $buf --> True)

so it has to be called as a method, not a sub.

Also note the way the first argument is declared, as a IO::Handle:D:, without a comma separating it from the second argument. That's the type of the object to which the method write is to be applied.

--
Fernando Santagata

Thank you!

I  a-l-m-o-s-t  understand it.

How to I turn the above into something that writes to a file?

Reply via email to