Another try at Parrot code...
#!/usr/local/bin/parrot
open P0, "data.txt","<" #Open file for reading and store filehandle in P0
readline S0, P0 #Assume all values are on same line.. read from filehandle P0 into S0
close P0 #Close filehandle P0
index I0, S0, " " #Find first occurance of space, as in find first word and store position in I0
substr S1, S0, 0, I0 #Extract first word from S0 into S1
length I1, S0 #Store length of line S0 into I1
REDO: #Redo until a certain point is reached..
length I2, S1 #Store length of word S1 into I2
sub I1, I2 #Subtract word length I2 from string length I1
substr S0, S0, I0, I1 #Remove substr from S0 starting from pos I0 ending at I1
substr S0, S0, 1, I1 #Remove the space at front
save I2 #Push word length on stack
print I2 #Print the length of the string
print "\n" #Add a newline
index I0, S0, " " #Find first occurance of space, as in find first word and store position in I0
substr S1, S0, 0, I0 #Extract first word from S0 into S1
length I1, S0 #Store length of line S0 into I1
ne I1, 0, REDO
end
This will read a line from a text file and push the word lengths on the user stack. I will, somehow, base a beatnik interpreter on this bit.