Perl Weekly Challenge 98: Read N-Characters and Search Insert Position
These are some answers to the Week 98 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Task 1: Read N-characters
You are given file $FILE.
Create subroutine readN($FILE, $number) that returns the first n-characters and moves the pointer to the (n+1)th character.
Example:
Input: Suppose the file (input.txt) contains "1234567890"
Output:
print readN("input.txt", 4); # returns "1234"
print readN("input.txt", 4); # returns "5678"
print readN("input.txt", 4); # returns "90"
Read N-characters in Raku
This is my first attempt:





