in reply to Parsing Test File
You're not testing for end-of-file, which is indicated by an undef return from the diamond operator. Breaking up your logic to test for EOF will guarantee that it'll stop, even if the file doesn't contain the string you expect. Plus it'll be easier to understand:
HTHwhile (<FIL>) { chomp; last if $_ eq ']'; # It's also possible to do "last if /^\]$/", but # all you need is a simple string compare. # do stuff }
|
|---|