|Don't ask to ask, just ask|
Re^3: How can I print three lines before pattern match?by QM (Parson)
|on Aug 14, 2009 at 03:02 UTC||Need Help??|
Is the #file a reference to my data file?
No, not directly. Instead, the idea presented was to capture the whole file in @file:
In your case, it would be <INFILE> instead of <DATA>. (<DATA> is a special file handle, starting after the special tag __DATA__ in the script, but otherwise pretty much a normal-behaving file handle.)
The $# in front of an array identifier means "the last index of" that array.
Perhaps better is to keep the last three lines in a fifo:
Don't forget warnings and strict.