|
|
| Do you know where your variables are? | |
| PerlMonks |
Re^3: How can I print three lines before pattern match?by QM (Vicar) |
| on Aug 14, 2009 at 03:02 UTC ( #788500=note: print w/ replies, xml ) | 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. -QM
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||