in reply to
Start by surfing for examples. Start with the very simplest one: a loop that reads a file and prints each line. From there, you can see your way to how to count the lines. Next, look at split, and write a separate experimental script that takes some string and splits it. Figure out how to count the number of elements in that string, and how to write a loop to iterate through the list. You can find examples of all of these things ... and this is the only way to learn how to do this stuff. You’re going to stumble, you’re going to make mistakes, and you’re going to learn the craft from that.