Glad that helped. If you're having trouble using $line in place of $_, that's probably because if you give split a variable, you have to give it a pattern first. So you could do split ' ', $line; to use split's special case where giving it a single space as the pattern argument makes it split on whitespace like it does when you give it no arguments.