I’m teaching myself perl so I’m pretty new to this language. I’ve been reading over and over about regular expression but I can’t figure out the right context. I want to do the following:
Let say I have a file name “testfile”
this files contains 3 lines,
test this is the first line
test: this is the first line
test; this is the third line
How can I read and print out only the third one and everything after the ; without the space. so basically “This is the third line”
This is what I’m thinking to do $string =~ m/this is the third/
This was edited incorrectly. In the first and second sentence there should a space before the test.in the third one shouldn’t. So I want to skip the white space.
Grabbing from STDIN, it might look like this: