I was using an older version of Rakudo (2023.05). 
With a newer version Rakudo (2024.09-01) you now have to `>>.Str` hyper or 
`.map(*.Str)` map to a string.
(I've also added a call to `@AltArray.elems.say`, at the end):

~$  
/Users/admin/rakudo/rakudo-2024.09/rakudo-moar-2024.09-01-macos-arm64-clang/bin/raku
 -e '  \
   my Str $AltClickHere = lines[0];  \
   my @AltArray = ($AltClickHere ~~ m:g/ <?before  download > .*? <?before \> | 
\h+ > /)>>.Str;   \
   .put for @AltArray; @AltArray.elems.say'  todd_test.txt
download='betterbird-128.6.0esr-bb20.de.linux-x86_64.tar.bz2'
download='betterbird-128.6.0esr-bb20.en-US.linux-x86_64.tar.bz2'
download='betterbird-128.6.0esr-bb20.es-AR.linux-x86_64.tar.bz2'
3
~$  
/Users/admin/rakudo/rakudo-2024.09/rakudo-moar-2024.09-01-macos-arm64-clang/bin/raku
 -e '  \
   my Str $AltClickHere = lines[0];  \
   my @AltArray = $AltClickHere.match(:global, / <?before  download > .*? 
<?before \> | \h+ > /)>>.Str;   \
   .put for @AltArray; @AltArray.elems.say'  todd_test.txt
download='betterbird-128.6.0esr-bb20.de.linux-x86_64.tar.bz2'
download='betterbird-128.6.0esr-bb20.en-US.linux-x86_64.tar.bz2'
download='betterbird-128.6.0esr-bb20.es-AR.linux-x86_64.tar.bz2'
3
~$  
/Users/admin/rakudo/rakudo-2024.09/rakudo-moar-2024.09-01-macos-arm64-clang/bin/raku
 -e '  \
   my Str $AltClickHere = lines[0];  my @AltArray; \
   @AltArray.push: $_ for $AltClickHere.match(:global, / <?before  download > 
.*? <?before \> | \h+ > /)>>.Str;   \
   .put for @AltArray; @AltArray.elems.say'  todd_test.txt
download='betterbird-128.6.0esr-bb20.de.linux-x86_64.tar.bz2'
download='betterbird-128.6.0esr-bb20.en-US.linux-x86_64.tar.bz2'
download='betterbird-128.6.0esr-bb20.es-AR.linux-x86_64.tar.bz2'
3


HTH, Bill.


> On Jan 11, 2025, at 02:22, ToddAndMargo via perl6-users 
> <perl6-us...@perl.org> wrote:
> 
> On 1/11/25 2:20 AM, ToddAndMargo via perl6-users wrote:
>> On 1/11/25 2:17 AM, ToddAndMargo wrote:
>>> On 1/10/25 9:35 PM, ToddAndMargo wrote:
>>>> 
>>>>> 
>>>>>> On Jan 10, 2025, at 17:50, ToddAndMargo via perl6-users <perl6- 
>>>>>> us...@perl.org> wrote:
>>>>>> 
>>>>>> Hi All,
>>>>>> 
>>>>>> I am scratching my head trying to figure out how to cut
>>>>>> up this long line;
>>>>>> 
>>>>>> 
>>>>>> download='betterbird-128.6.0esr-bb20.de.linux-x86_64.tar.bz2'><div 
>>>>>> class="img bz2"></div><div class="name"><div class="file fs-1-2 
>>>>>> bold">betterbird-128.6.0esr-bb20.de.linux-x86_64.tar.bz2</div><div 
>>>>>> class="data upper size fs-0-7"><span class="bold">Size:</span> 
>>>>>> 80.26<span class="fs-0-8 bold">MB</span></div><div class="data upper 
>>>>>> modified fs-0-7"><span class="bold">Last modified:</span> Tue. January 
>>>>>> 7th, 2025 - 10:54pm</div></div></a></div><div class="block"><a 
>>>>>> href="LinuxArchive/betterbird-128.6.0esr-bb20.en- US.linux- 
>>>>>> x86_64.tar.bz2" class="bz2" download='betterbird-128.6.0esr-bb20.en- 
>>>>>> US.linux- x86_64.tar.bz2'><div class="img bz2"></div><div 
>>>>>> class="name"><div class="file fs-1-2 bold">betterbird-128.6.0esr- 
>>>>>> bb20.en-US.linux- x86_64.tar.bz2</div><div class="data upper size 
>>>>>> fs-0-7"><span class="bold">Size:</span> 80.04<span class="fs-0-8 
>>>>>> bold">MB</ span></ div><div class="data upper modified fs-0-7"><span 
>>>>>> class="bold">Last modified:</span> Tue. January 7th, 2025 - 10:42pm</ 
>>>>>> div></div></a></ div><div class="block"><a href="LinuxArchive/ 
>>>>>> betterbird-128.6.0esr- bb20.es-AR.linux- x86_64.tar.bz2" class="bz2" 
>>>>>> download='betterbird-128.6.0esr- bb20.es-AR.linux- x86_64.tar.bz2'><div 
>>>>>> class="img bz2"></div><div class="name"><div class="file fs-1-2 
>>>>>> bold">betterbird-128.6.0esr- bb20.es-AR.linux- x86_64.tar.bz2</div>
>>>>>> 
>>>>>> 
>>>>>> What I want to come out of it is an array of stings starting
>>>>>> at "download" and ending at ">" or "<"
>>>>>> 
>>>>>> download='betterbird-128.6.0esr-bb20.de.linux-x86_64.tar.bz2'
>>>>>> download='betterbird-128.6.0esr-bb20.en-US.linux-x86_64.tar.bz2'
>>>>>> download='betterbird-128.6.0esr-bb20.es-AR.linux- 
>>>>>> x86_64.tar.bz2'x86_64.tar.bz2
>>>>>> 
>>>>>> 
>>>>>> Many thanks,
>>>>>> -T
>>>> 
>>>> On 1/10/25 8:59 PM, William Michels via perl6-users wrote:
>>>>  > Hi Todd,
>>>>  >
>>>>  > ~$ raku -ne 'put $/.join("\n") if m:g/ <?before  download> .*? <? before
>>>>  > \> | \h+ > /;'  todd_test.txt
>>>>  > download='betterbird-128.6.0esr-bb20.de.linux-x86_64.tar.bz2'
>>>>  > download='betterbird-128.6.0esr-bb20.en-US.linux-x86_64.tar.bz2'
>>>>  > download='betterbird-128.6.0esr-bb20.es-AR.linux-x86_64.tar.bz2'
>>>>  >
>>>>  > See: https://docs.raku.org/syntax/%24%2F <https://docs.raku.org/ syntax/
>>>>  > %24%2F>
>>>>  > See: https://docs.raku.org/language/regexes#Lookahead_assertions
>>>>  > <https://docs.raku.org/language/regexes#Lookahead_assertions>
>>>>  >
>>>>  > OR:
>>>>  >
>>>>  > ~$ raku -ne 'put $/.join("\n") if m:g/ <( download  .*? )> [ \> |
>>>>  > \h+ ] /;'  todd_test.txt
>>>>  > download='betterbird-128.6.0esr-bb20.de.linux-x86_64.tar.bz2'
>>>>  > download='betterbird-128.6.0esr-bb20.en-US.linux-x86_64.tar.bz2'
>>>>  > download='betterbird-128.6.0esr-bb20.es-AR.linux-x86_64.tar.bz2'
>>>>  >
>>>>  > See: https://docs.raku.org/language/ regexes#Capture_markers:_%3C(_)%3E
>>>>  > <https://docs.raku.org/language/regexes#Capture_markers:_%3C(_)%3E>
>>>>  >
>>>>  > Let me know if this is part of a larger script, how you're obtaining the
>>>>  > input line(s), etc., if you need more guidance.
>>>>  >
>>>>  > HTH,
>>>>  >
>>>>  > Bill.
>>>>  >
>>>> 
>>>> Hi Bill,
>>>> 
>>>> Thank you!
>>>> 
>>>> I will not have the time to do any programming till maybe
>>>> Sunday, so I will not have a chance till then to test
>>>> this out.
>>>> 
>>>> Yes, this is a simplification of a much larger program.
>>>> The line in question is
>>>> 
>>>> line 379
>>>> view-source:https://www.betterbird.eu/downloads/index.php
>>>> 
>>>> The YUGE run on line.  (I hate when they do that.)
>>>> 
>>>> I am having a problem figuring out how to get your example
>>>> into an array of strings.
>>>> 
>>>> The long line will reside in
>>>>     my Str $AltClickHere;
>>>> 
>>>> And the resulting array will reside in
>>>>     my @AltArray
>>>> 
>>>> Would you mind showing me how to do that whilst I wait
>>>> for some free time?
>>>> 
>>>> Many thanks,
>>>> -T
>>> 
>>>     my Str $AltClickHere  = "";
>>>     my @AltArray;
>>> 
>>> @AltArray = $AltClickHere ~~ m:g/ <?before ^ | download > .*? <?before \> | 
>>> \h+ > /;  .put for @AltArray;
>>> 
>>> Type check failed for an element of @AltArray; expected Str but got Match 
>>> (Match.new(:orig("dow...)
>> I tool out the "Str" from my array declaration .    Now I
>> am getting
>> Too many positionals passed; expected 1 argument but got 2
> 
> 
> Got it!
> 
> I took out the .put
> 
> @AltArray = $AltClickHere ~~ m:g/ <?before ^ | download > .*? <?before \> | 
> \h+ > /;  # .put for @AltArray;
> 
> Thank you!!!!
> -T
> 
> 

Reply via email to