> "note" is the same thing as "say", but to the std error:

Er, I was referring more to the P5 behaviour of warn() - w/o a newline, its
output, to stderr, included more info:
$  perl -e 'warn("hi mom")'  > /dev/null
hi mom at -e line 1.

$  perl -e 'warn("hi mom\n")' > /dev/null
hi mom

"note" appears to append a new line and p6 warn appears to always add the
extra info.  Looking at
https://docs.perl6.org/routine/warn

I see warn is doing even more that.

Thanks.

On Fri, Sep 15, 2017 at 3:58 PM, ToddAndMargo <toddandma...@zoho.com> wrote:

> On 09/15/2017 01:48 PM, Andy Bach wrote:
>
>> So "note"
>> $ perl6 -e 'note "hi mom"' > /dev/null
>> hi mom
>>
>> replaces "warn ...\n" or
>>
>> $ perl6 -e 'warn "hi mom\n"' > /dev/null
>> hi mom
>>
>>    in block <unit> at -e line 1
>>
>> have I forgotten my p6 newline syntax (again)?
>>
>
>
> Hi Andy,
>
> Oh goody.  I get to help someone for once!
>
> "note" is the same thing as "say", but to the std error:
>
> $ perl6 -e '$*ERR.say: "print to std err";'
> print to std err
>
> $ perl6 -e 'note "print to std err";'
> print to std err
>
> $ perl6 -e 'note "print to std err";' > /dev/null
> print to std err
>
> $ perl6 -e 'note "print ", "to ", "std err";' > /dev/null 2>&1
> <nothing>
>
> "2>&1" redirects STDERR to STDOUT.  And, you put it "after"
> the "/dev/null".  It is a "bash" thing.
>
>
> > have I forgotten my p6 newline syntax (again)?
>
> "\n".  It means new line.  Perl takes care of whether or
> not that is a CR-LF or a LF depending on the OS involved.
>
> example:
> $ perl6 -e '$*ERR.print: "print to std err\n";'
> print to std err
>
>
> -T
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Serious error.
> All shortcuts have disappeared.
> Screen. Mind. Both are blank.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>



-- 

a

Andy Bach,
afb...@gmail.com
608 658-1890 cell
608 261-5738 wk

Reply via email to