That is, when I'm talking to a human, I say "read in a line of text. If it ends in a newline, remove it". A human understands that. But a programming language says, "Read the line in from where? Read the into what variable? And, if what ends in a newline?"
But Perl has a default place to read input from, so if that works, you can just say "read in a line" without specifying from where. And it has a default variable, which is where the line will be stored if you don't specify somewhere else. That variable plays the role of "it" - it's what we're talking about if we don't specify something else. So "if it ends in a newline" means "if the default variable ends in a newline" without having to actually specify that I mean that variable.
It's very handy. And, like "it" in English, it can also cause confusion.
But I (a non-linguist) think it's linguistically interesting.