Re: Inconsistency between one-liner flags (-ne, -pe) using chop example?

2020-05-05 Thread Gianni Ceccarelli
On 2020-05-05 William Michels via perl6-users wrote: > If the only difference between the "-n" and "-p" flags is really that > the second one autoprints $_, I would have expected the "-pe" code > above to work identically to the "-ne" case (except "-ne" requires a > print, put or say). Presumably

Re: Inconsistency between one-liner flags (-ne, -pe) using chop example?

2020-05-05 Thread Laurent Rosenfeld via perl6-users
In: perl6 -ne 'put .chop' demo1.txt the script prints out the value returned by the chop method, because put acts on this value. In: perl6 -pe '.chop' demo1.txt the value returned by chop is discarded and the script print $_ unaltered. Cheers, Laurent. Le mar. 5 mai 2020 à 21:07, William Michel

Re: I need help with sub MAIN

2020-05-05 Thread yary
Oops my example was missing the important $*USAGE message. And it makes sense to show the wrong named args before the wrong list args. example.raku: multi sub MAIN(:$these ="These", :$are="Are") { say "$these $are"; }; multi sub MAIN(*@wrong-list,:$these ="These", :$are="Are",*%wrong-named) is

Re: I need help with sub MAIN

2020-05-05 Thread yary
Here's something to play with (without explanation from me, busy enough sorry!) example.raku: multi sub MAIN(:$these ="These", :$are="Are") { say "$these $are"; }; multi sub MAIN(*@wrong-list,:$these ="These", :$are="Are",*%wrong-named) is hidden-from-USAGE {say "Got bad args " ~ @wrong-l

Re: Inconsistency between one-liner flags (-ne, -pe) using chop example?

2020-05-05 Thread William Michels via perl6-users
On Tue, May 5, 2020 at 8:01 AM Gianni Ceccarelli wrote: > > On 2020-05-05 William Michels via perl6-users > wrote: > > mbook:~ homedir$ perl6 -ne 'put .chop' demo1.txt > > this is a test > > I love Unix > > I like Linux too > > mbook:~ homedir$ perl6 -pe '.chop' demo1.txt > > this is a test, > >

Re: I need help with sub MAIN

2020-05-05 Thread ToddAndMargo via perl6-users
On Tue, 5 May 2020, 06:46 ToddAndMargo via perl6-users, mailto:perl6-us...@perl.org>> wrote: Hi All, Just to prove I read the stinker: https://docs.raku.org/routine/MAIN I am trying to get the following to do #!/usr/bin/env perl6 sub MAIN(:$these ="These", :$are="Are")

Re: Inconsistency between one-liner flags (-ne, -pe) using chop example?

2020-05-05 Thread Gianni Ceccarelli
On 2020-05-05 William Michels via perl6-users wrote: > mbook:~ homedir$ perl6 -ne 'put .chop' demo1.txt > this is a test > I love Unix > I like Linux too > mbook:~ homedir$ perl6 -pe '.chop' demo1.txt > this is a test, > I love Unix, > I like Linux too, The ``.chop`` method does not mutate its ar

Inconsistency between one-liner flags (-ne, -pe) using chop example?

2020-05-05 Thread William Michels via perl6-users
Hi, I was trying to write raku/perl6 version of the sed code listed in this article: "How to sed remove last character from each line" https://www.cyberciti.biz/faq/sed-remove-last-character-from-each-line/ What I came up with was two one-liners. But the first one-liner using the "-ne" flag works

Re: I need help with sub MAIN

2020-05-05 Thread Simon Proctor
I would suggest starting by reading this page in the docs : https://docs.raku.org/language/create-cli Covers how $*USAGE is created and the various options you have for providing help data. On Tue, 5 May 2020, 06:46 ToddAndMargo via perl6-users, < perl6-us...@perl.org> wrote: > Hi All, > > Just