Aww don't you remember Raku's earliest(?) contribution to Perl? I was so
happy when this arrived, and sad over its subsequent neglect

perl -ne 'no warnings "experimental"; print if $. ~~ [3,5,11]' line0-10.txt


-y


On Mon, Aug 31, 2020 at 8:28 AM William Michels via perl6-users <
perl6-us...@perl.org> wrote:

> How would P5 handle line numbers > 10 ? Not getting back line #11 with
> the P5 examples below:
>
> $ raku -ne '.say if ++$ == 3|2|5|11' test_lines.txt
> Line 2
> Line 3
> Line 5
> Line 11
>
> ~$ perl -ne 'print if $. =~ /\b[3 2 5 11]\b/' test_lines.txt
> Line 1
> Line 2
> Line 3
> Line 5
>
> ~$ perl -ne 'print if $. =~ /\b[3,2, 5, 11]\b/' test_lines.txt
> Line 1
> Line 2
> Line 3
> Line 5
>
> On Mon, Aug 31, 2020 at 8:17 AM Brian Duggan <bdug...@matatu.org> wrote:
> >
> > On Monday, August 31, Andy Bach wrote:
> > > >  raku -ne '.say if $++ == 3|2|5' Lines.txt
> > >
> > > OT, maybe, but is
> > > perl -ne 'print if $. =~ /\b[325]\b/' Lines.txt
> > >
> > > or
> > > perl -ne 'print if $c++ =~ /\b[436]\b/' Lines.txt
> > >
> > > the best you can do in P5?
> >
> > I can't think of anything better :-)
> >
> > Brian
>

Reply via email to