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
You want to do two things:
1. match/replace something
2. match/replace something else
To do this in one command you need:
* `:g` to tell P6 to keep going after the first match
* `||` to tell P6 to match what's on the left first, or if that fails,
what's on the right
Which yields:
my $x="
On Sat, Sep 23, 2017 at 2:09 AM, ToddAndMargo wrote:
> method write(IO::Handle:D: Blob:D $buf --> True)
>
The key here is the colon *after* `IO::Handle:D`: that marks the Handle as
an invocant, i.e. this is a method to be applied to an object. (The fact
that it has a `type smiley`, i.e. an
On Sat, Sep 23, 2017 at 2:34 AM, ToddAndMargo wrote:
> I see ":truncate". This seems liek it will do the trick.
> Problem: I would like to read from the file first before
> truncating (ro).
>
> Is there a way to do this, or should I
>1) open the handle with :ro
>2) read what I want from
On Sat, Sep 23, 2017 at 3:31 PM, Brandon Allbery
wrote:
> On Sat, Sep 23, 2017 at 2:09 AM, ToddAndMargo
> wrote:
>
>> method write(IO::Handle:D: Blob:D $buf --> True)
>>
>
> The key here is the colon *after* `IO::Handle:D`: that marks the Handle as
> an invocant, i.e. this is a method to b
>> Hi All,
>>
>> Question. Can I chain these two substitutions together?
>>
>> $ perl6 -e 'my $x="State : abc "; $x ~~ s/.*?" : "//; $x ~~ s/"
>> ".*//; say "<$x>";'
>>
>>
>>
>> Many thanks,
>> -T
On 09/23/2017 07:58 AM, raiph mellor wrote:
You want to do two things:
1. match/replace