Re: need help with "next"

2017-05-24 Thread ToddAndMargo
On 05/24/2017 01:04 AM, Richard Hainsworth wrote: see https://docs.perl6.org/language/regexes#Subrules Fascinating and way over my head. Give me a year or two to catch up.

Re: need help with "next"

2017-05-24 Thread ToddAndMargo
On 05/24/2017 01:04 AM, Richard Hainsworth wrote: On 05/23/2017 10:31 PM, Richard Hainsworth wrote: > The code below seems unnecessarily complex. > > How about: > > my @Data = q:to/SAMPLE/; > > Mission D', > Sol Wheat, > Ted Moon, > ; > > SAMPLE > > for @Data { >

Re: need help with "next"

2017-05-24 Thread Richard Hainsworth
On 05/23/2017 10:31 PM, Richard Hainsworth wrote: > The code below seems unnecessarily complex. > > How about: > > my @Data = q:to/SAMPLE/; > > Mission D', > Sol Wheat, > Ted Moon, > ; > > SAMPLE > > for @Data { > next unless m/ 'NAME' .*? '>' $=( .*? ) '<' /; >

Re: need help with "next"

2017-05-24 Thread ToddAndMargo
On 05/24/2017 12:02 AM, Norman Gaywood wrote: On 24 May 2017 at 16:40, Norman Gaywood > wrote: However, your code does not look like it will do what you want if you have multiple TASKs Yes it does. Sorry ignore me :-) Oh it

Re: need help with "next"

2017-05-24 Thread ToddAndMargo
On 05/23/2017 11:40 PM, Norman Gaywood wrote: I'm a rank beginner p6 programmer so You are further along than me!

Re: need help with "next"

2017-05-24 Thread ToddAndMargo
On 05/23/2017 11:40 PM, Norman Gaywood wrote: However, your code does not look like it will do what you want if you have multiple TASKs I improved it. See my other follow post #3

Re: need help with "next"

2017-05-24 Thread ToddAndMargo
Oh, you know what, I thought it might be a good idea to throw some negative case data into the mix. This is what I came up with: #!/usr/bin/env perl6 use strict; my @Data = 'Mission A', ' Peter Meter', ' John Deer', ' Sam Horse', '',

Re: need help with "next"

2017-05-24 Thread Norman Gaywood
On 24 May 2017 at 16:40, Norman Gaywood wrote: > > However, your code does not look like it will do what you want if you have >> multiple TASKs >> > > Yes it does. Sorry ignore me :-) -- Norman Gaywood, Computer Systems Officer School of Science and Technology University

Re: need help with "next"

2017-05-24 Thread Norman Gaywood
On 24 May 2017 at 15:20, ToddAndMargo wrote: > > > This is what I came up with. I found that `next` did not serve me > well, so i just used a tag. > > Thank you all for the help. I had a bit of a time wrapping > my head around `next` there for a while. > > -T > > >

Re: need help with "next"

2017-05-24 Thread ToddAndMargo
On Wednesday, May 24, 2017 01:20 PM, ToddAndMargo wrote: On 05/23/2017 09:30 PM, ToddAndMargo wrote: Hi All, I have a test code in progress and I haven't figured out how to get 'next' to work the way I want. next if $Line.contains( "TASK type" ); works, but if $Line.contains(

Re: need help with "next"

2017-05-23 Thread Richard Hainsworth
The code below seems unnecessarily complex. How about: my @Data = q:to/SAMPLE/; Mission D', Sol Wheat, Ted Moon, ; SAMPLE for @Data { next unless m/ 'NAME' .*? '>' $=( .*? ) '<' /; say $; # say implicitly stringifies $ } On Wednesday, May 24, 2017 01:20 PM,

Re: need help with "next"

2017-05-23 Thread ToddAndMargo
On 05/23/2017 09:30 PM, ToddAndMargo wrote: Hi All, I have a test code in progress and I haven't figured out how to get 'next' to work the way I want. next if $Line.contains( "TASK type" ); works, but if $Line.contains( "TASK type" ) { next; does not. What am I missing?

Re: need help with "next"

2017-05-23 Thread ToddAndMargo
Any data fulfilling the 'if' condition, and thus entering this block will be 'next'ed. Nothing will pass the 'next'. But no data not fulfilling the condition will 'see' the code below, which is not what you intend. Perhaps you omitted an 'else' clause after the 'next' statement? Okay I get

Re: need help with "next"

2017-05-23 Thread Richard Hainsworth
On Wednesday, May 24, 2017 12:46 PM, ToddAndMargo wrote: On Tue, May 23, 2017 at 11:30 PM, ToddAndMargo wrote: Hi All, I have a test code in progress and I haven't figured out how to get 'next' to work the way I want. next if $Line.contains( "TASK type" );

Re: need help with "next"

2017-05-23 Thread ToddAndMargo
On Tue, May 23, 2017 at 11:30 PM, ToddAndMargo wrote: Hi All, I have a test code in progress and I haven't figured out how to get 'next' to work the way I want. next if $Line.contains( "TASK type" ); works, but if $Line.contains( "TASK type" ) {

Re: need help with "next"

2017-05-23 Thread Brad Gilbert
You do realize that `next` immediately stops the current iteration and goes onto the *next* one right? That is, there is no point putting any code after it because it will never be run. On Tue, May 23, 2017 at 11:30 PM, ToddAndMargo wrote: > Hi All, > > I have a test code

need help with "next"

2017-05-23 Thread ToddAndMargo
Hi All, I have a test code in progress and I haven't figured out how to get 'next' to work the way I want. next if $Line.contains( "TASK type" ); works, but if $Line.contains( "TASK type" ) { next; does not. What am I missing? Many thanks, -T yes I know I still have some