This channel is intended for people just starting with the Raku Programming Language ( Logs are available at
Set by lizmat on 8 June 2022.
00:02 kjp left 00:06 kjp joined 00:29 mjgardner left, SmokeMachine left, hexology left, SmokeMachine joined, mjgardner joined 00:30 hexology joined 02:57 guifa__ joined 02:59 guifa left 04:56 jgaz left 05:34 siavash joined 07:37 ab5tract joined 08:01 dakkar joined 08:20 teatwo joined, teatwo left 08:21 teatwo joined, teatwo left 08:22 teatwo joined 08:23 teatime left 08:24 ab5tract left 08:25 ab5tract joined
lizmat PSA: is now officially offline, if you were still using that, please use instead 08:55
10:27 NemokoschKiwi joined 10:54 teatime joined, teatime left 11:22 ab5tract left 11:23 NemokoschKiwi left 12:06 jaguart joined 12:07 jaguart left 12:08 jaguart joined 12:55 siavash left 14:26 deoac left 14:27 deoac joined 16:36 dakkar left 18:34 ab5tract joined 18:43 wafflus joined
wafflus when looping thought a file how do i get the next line after i match? 18:55
nemokosch Could you illustrate it? 19:08
wafflus when /\.ITEM/' {get next line and print } 19:11
19:14 ab5tract left
wafflus maybe i need a state var 19:16
nemokosch you can retrieve a line from a file handle using get, if that helps 19:18
the other solution I'm looking into is with toggle 19:21
wafflus yeah i've been messing around alot as well lol 19:22
i;m sure i will get it using the get it took me a few mine to understand how to use it 19:27
nemokosch at the end of the day, it depends what you want to do, too 19:28
I managed it with toggle eventually
'filename'.IO.lines.toggle(:off, *.match(pattern)) is the sequence of lines starting from the match 19:29
wafflus ok thanks
nemokosch if you need a more stateful, more procedural processing, I'd use something like
loop (my $fh = open('filename'.IO), my $line = $fh.get; $line.defined; $line = $fh.get) { ... } 19:30
do something depending on the value of $line, maybe fetch the next line 19:31
wafflus k iyeah that's what i was trying to do :)
nemokosch keep in mind that in this case, $fh and $line belong to the surrounding scope so they are visible after the loop as well 19:33
wafflus so confusing i'll get it eventually 19:36
19:37 n1to joined, n1to left
wafflus raku -e ' loop (my $fh = open("./install-next.txt".IO), my $line = $fh.get; $line.defined; $line = $fh.get) {.say when /\.ITEM/ }' 19:39
why am i geting this error all the time Use of uninitialized value of type Any in string context.
Methods .^name, .raku, .gist, or .say can be used to stringify it to something meaningful.
  in block at -e line 1
i got it cu around thanks 19:49
19:49 wafflus left 20:20 tea3po joined 20:23 teatwo left 20:52 deoac left
nemokosch because you are calling .say without having a topic set 21:17
you could wrap it in given $line { } 21:18