number of letters question

2018-05-15 Thread ToddAndMargo
Hi All, Do we have one of those sweet functions that will allow us to look at a string and give us back the count of how many "letters" and/or "numbers" are in a string? And are decimal points considered numbers or letters? Many thanks, -T

Re: Need help converting from Perl 5

2018-05-15 Thread JJ Merelo
As far as I understand it, HTTP::UserAgent is preferred over LWP::Simple. It does work to spec now, so I'm using it... El mar., 15 may. 2018 a las 8:44, ToddAndMargo () escribió: > On 05/14/2018 02:42 AM, JJ Merelo wrote: > > Maybe this will work > > > > use

Re: number of letters question

2018-05-15 Thread JJ Merelo
IN Perl 6, it's a bit more complicated. Do you want to count graphemes or codepoints? El mar., 15 may. 2018 a las 8:32, ToddAndMargo () escribió: > Hi All, > > Do we have one of those sweet functions that will > allow us to look at a string and give us back the > count of

Re: Need help converting from Perl 5

2018-05-15 Thread ToddAndMargo
On 05/14/2018 02:42 AM, JJ Merelo wrote: Maybe this will work use HTTP::UserAgent; my $ua = HTTP::UserAgent.new; $ua.timeout = 10; my $response = $ua.get("https://ftp.mozilla.org/pub/firefox/releases/;); if $response.is-success {     say $response.content ~~ m:g{\> (\d+ \. .+?) \/}; } Hi

Re: number of letters question

2018-05-15 Thread ToddAndMargo
El mar., 15 may. 2018 a las 8:32, ToddAndMargo (>) escribió: Hi All, Do we have one of those sweet functions that will allow us to look at a string and give us back the count of how many "letters" and/or "numbers" are in

Re: number of letters question

2018-05-15 Thread JJ Merelo
Well, say + "abcrd-12.3.4".comb.grep: // will give you that, but say + "abcñé-12.3.4".comb.grep: // will yield the same result. Roman or other kind of numerals are excluded, though... El mar., 15 may. 2018 a las 9:44, ToddAndMargo () escribió: > On 05/15/2018 12:37 AM, JJ

Re: number of letters question

2018-05-15 Thread JJ Merelo
Hi, El mar., 15 may. 2018 a las 9:31, ToddAndMargo () escribió: > >> El mar., 15 may. 2018 a las 8:32, ToddAndMargo ( >> >) escribió: > >> > >> Hi All, > >> > >> Do we have one of those sweet functions that will

Re: number of letters question

2018-05-15 Thread ToddAndMargo
On 05/15/2018 12:37 AM, JJ Merelo wrote: Hi, El mar., 15 may. 2018 a las 9:31, ToddAndMargo (>) escribió: >> El mar., 15 may. 2018 a las 8:32, ToddAndMargo ( >>

Re: number of letters question

2018-05-15 Thread ToddAndMargo
On 05/15/2018 12:57 AM, JJ Merelo wrote: Well, say + "abcrd-12.3.4".comb.grep: // will give you that, but say + "abcñé-12.3.4".comb.grep: // will yield the same result. Roman or other kind of numerals are excluded, though... $ perl6 -e 'say + "abcrd-12.3.4".comb.grep: //;' 9 I don't

Re: number of letters question

2018-05-15 Thread ToddAndMargo
On 05/15/2018 02:45 AM, Brent Laabs wrote: /<+alnum-[_]>/. What does the `+` do? Is there a was to write that to include decimal points (or any other weird character)?

Re: number of letters question

2018-05-15 Thread Timo Paulssen
I'd suggest combing for the regex instead of combing and then grepping with the regex: say + "abcrd-12.3.4".comb(//); though from the problem question it sounds a lot more like what todd wants is     my $input = "abcrd-12.3.4";     my $letters = $input.comb(/<[a..z]>/);     my $numbers =

Re: Need match character help

2018-05-15 Thread Timo Paulssen
On 15/05/18 14:03, ToddAndMargo wrote: > On 05/15/2018 04:49 AM, ToddAndMargo wrote: >> Hi All, >> >> This should be a "no".  What am I doing wrong? >> >> $ perl6 -e 'my $x="rd"; if $x~~/<[rc]+[a]+[b]+[.]>/ {say >> "yes"}else{say "no"}' >> yes >> >> >> Many thanks, >> -T > > And how do I turn this

Re: Need match character help

2018-05-15 Thread Timo Paulssen
On 15/05/18 13:49, ToddAndMargo wrote: > Hi All, > > This should be a "no".  What am I doing wrong? > > $ perl6 -e 'my $x="rd"; if $x~~/<[rc]+[a]+[b]+[.]>/ {say > "yes"}else{say "no"}' > yes > > > Many thanks, > -T what you've put in your regex here is a character class combined of four

Re: number of letters question

2018-05-15 Thread ToddAndMargo
On 05/15/2018 02:45 AM, Brent Laabs wrote: Just a quick reminder that matches the underscore, because also does.  If you want to exclude underscores, you can match against /<+alnum-[_]>/.  That adds the alnum character class, but subtracts underscores from it.   Decimal points are definitely

Need match character help

2018-05-15 Thread ToddAndMargo
Hi All, This should be a "no". What am I doing wrong? $ perl6 -e 'my $x="rd"; if $x~~/<[rc]+[a]+[b]+[.]>/ {say "yes"}else{say "no"}' yes Many thanks, -T

Re: Need match character help

2018-05-15 Thread ToddAndMargo
On 05/15/2018 04:49 AM, ToddAndMargo wrote: Hi All, This should be a "no".  What am I doing wrong? $ perl6 -e 'my $x="rd"; if $x~~/<[rc]+[a]+[b]+[.]>/ {say "yes"}else{say "no"}' yes Many thanks, -T And how do I turn this into a yes. I am look for any instance of d through z $ perl6 -e

Re: number of letters question

2018-05-15 Thread JJ Merelo
El mar., 15 may. 2018 a las 13:48, ToddAndMargo () escribió: > On 05/15/2018 02:45 AM, Brent Laabs wrote: > > /<+alnum-[_]>/. > > What does the `+` do? > + includes a category, - eliminates one category. Check out the regexes page https://docs.perl6.org/language/regexes

Re: number of letters question

2018-05-15 Thread Brent Laabs
Just a quick reminder that matches the underscore, because also does. If you want to exclude underscores, you can match against /<+alnum-[_]>/. That adds the alnum character class, but subtracts underscores from it. Decimal points are definitely not alphanumeric, though. On Tue, May 15,

Re: number of letters question

2018-05-15 Thread Larry Wall
On Tue, May 15, 2018 at 12:44:12AM -0700, ToddAndMargo wrote: : "abcrd-12.3.4" would be five letters, six numbers, and one : I don't care. Here's another approach: $ p6 '"abcrd-12.3.4".comb.classify(*.uniprop).say' {Ll => [a b c r d], Nd => [1 2 3 4], Pd => [-], Po => [. .]} $ p6

Re: number of letters question

2018-05-15 Thread Andy Bach
> though from the problem question it sounds a lot more like what todd wants is my $input = "abcrd-12.3.4"; my $letters = $input.comb(/<[a..z]>/); my $numbers = $input.comb(/<[a..z 0..9 .]>/); say "the string $input has $letters letters and $numbers numbers and periods."; Just a

Re: number of letters question

2018-05-15 Thread ToddAndMargo
On 05/15/2018 10:05 AM, Larry Wall wrote: On Tue, May 15, 2018 at 12:44:12AM -0700, ToddAndMargo wrote: : "abcrd-12.3.4" would be five letters, six numbers, and one : I don't care. Here's another approach: $ p6 '"abcrd-12.3.4".comb.classify(*.uniprop).say' {Ll => [a b c r d], Nd =>

Re: Is there a backward "for @"

2018-05-15 Thread ToddAndMargo
On 05/15/2018 03:31 PM, ToddAndMargo wrote: do the backwards do theM backwards mumble, mumble

Re: Is there a backward "for @"

2018-05-15 Thread Brock Wilcox
Slightly more idiomatic might be `next unless $line`. On Tue, May 15, 2018 at 7:39 PM ToddAndMargo wrote: > On 05/15/2018 04:34 PM, ToddAndMargo wrote: > > On 05/15/2018 03:49 PM, Larry Wall wrote: > >> On Tue, May 15, 2018 at 03:31:07PM -0700, ToddAndMargo wrote: > >> :

Re: number of letters question

2018-05-15 Thread JJ Merelo
El mar., 15 may. 2018 a las 10:17, ToddAndMargo () escribió: > On 05/15/2018 12:57 AM, JJ Merelo wrote: > > Well, > > say + "abcrd-12.3.4".comb.grep: // > > will give you that, but > > say + "abcñé-12.3.4".comb.grep: // > > will yield the same result. > > Roman or other

Re: Is there a backward "for @"

2018-05-15 Thread ToddAndMargo
On 05/15/2018 05:32 PM, Brock Wilcox wrote: Slightly more idiomatic might be `next unless $line`. Interesting! Thank you!

Re: Is there a backward "for @"

2018-05-15 Thread Larry Wall
On Tue, May 15, 2018 at 03:31:07PM -0700, ToddAndMargo wrote: : Hi All, : : This seems like a trivial question, but I really adore : the "for" loops. Is there a way to do the backwards? : In other words, start at the end of the array and loop : to the beginning? Does the "next" and "last" work

Re: Is there a backward "for @"

2018-05-15 Thread ToddAndMargo
On 05/15/2018 03:49 PM, Larry Wall wrote: On Tue, May 15, 2018 at 03:31:07PM -0700, ToddAndMargo wrote: : Hi All, : : This seems like a trivial question, but I really adore : the "for" loops. Is there a way to do the backwards? : In other words, start at the end of the array and loop : to the

Re: Is there a backward "for @"

2018-05-15 Thread ToddAndMargo
On 05/15/2018 04:34 PM, ToddAndMargo wrote: On 05/15/2018 03:49 PM, Larry Wall wrote: On Tue, May 15, 2018 at 03:31:07PM -0700, ToddAndMargo wrote: : Hi All, : : This seems like a trivial question, but I really adore : the "for" loops.  Is there a way to do the backwards? : In other words,

Re: Need match character help

2018-05-15 Thread ToddAndMargo
On 05/15/2018 07:05 AM, Timo Paulssen wrote: On 15/05/18 13:49, ToddAndMargo wrote: Hi All, This should be a "no".  What am I doing wrong? $ perl6 -e 'my $x="rd"; if $x~~/<[rc]+[a]+[b]+[.]>/ {say "yes"}else{say "no"}' yes Many thanks, -T what you've put in your regex here is a character

Re: Need match character help

2018-05-15 Thread ToddAndMargo
On 05/15/2018 07:06 AM, Timo Paulssen wrote: On 15/05/18 14:03, ToddAndMargo wrote: On 05/15/2018 04:49 AM, ToddAndMargo wrote: Hi All, This should be a "no".  What am I doing wrong? $ perl6 -e 'my $x="rd"; if $x~~/<[rc]+[a]+[b]+[.]>/ {say "yes"}else{say "no"}' yes Many thanks, -T And

Is there a backward "for @"

2018-05-15 Thread ToddAndMargo
Hi All, This seems like a trivial question, but I really adore the "for" loops. Is there a way to do the backwards? In other words, start at the end of the array and loop to the beginning? Does the "next" and "last" work in this? Inquiring minds want to know! Many thanks, -T