Sorry, I forgot the block thing (it reads the following block as a parameter). ``` lines() ``` would also have worked.
On Friday, August 4, 2017, ToddAndMargo <toddandma...@zoho.com> wrote: > > > On Friday, August 4, 2017, ToddAndMargo <toddandma...@zoho.com > > <mailto:toddandma...@zoho.com>> wrote: > > > > Hi All, > > > > > > What am I doing wrong here? > > > > $ echo -e "abc\ndef\nghi" | perl6 -e 'for ( split "\n", lines ) { > > say "<$_>"; }' > > > > <abc def ghi> > > > > > > I am trying to get > > > > <abc> > > <def> > > <ghi> > > > On 08/04/2017 11:59 AM, Brandon Allbery wrote: > >> That's a weird thing to do. You call a function that returns the lines of >> input as a list, in a context that joins them back together as words, and >> then try to split the result on lines again. >> >> lines already gives you what you want. Don't split. >> >> perl6 -e 'for lines { say "<$_>"; }' >> > > I am trying to test for something on each line. > > Poop! > $ echo -e "abc\ndef\nghi" | perl6 -e 'for lines { say "<$_>"; }' > ===SORRY!=== > Function 'lines' needs parens to avoid gobbling block > at -e:1 > ------> for lines { say "<$_>"; }⏏<EOL> > Missing block (apparently claimed by 'lines') > at -e:1 > ------> for lines { say "<$_>"; }⏏<EOL> > > > Ahh, much better: > > $ echo -e "abc\ndef\nghi" | perl6 -e 'for ( lines ) { say "<$_>"; }' > <abc> > <def> > <ghi> > -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net