in reply to Newbie Text Parsing Question

If file size is a concern, just keep the recent lines in an array instead of slurping up everything. I just threw this thing together but it seems to do the trick:
use strict; my $fileglob = shift || '*.pl'; my $pattern = shift || 'hello'; my $keeplines = shift || 3; for my $file (<${fileglob}>) { unless(open(IN, $file)) { warn "Can't read from $file: $!"; next; } my @lines; while(<IN>) { push @lines, $_; shift @lines if(@lines > $keeplines); if(/$pattern/i) { print "--- From $file:---\n@lines\n" } } }

--
I'd like to be able to assign to an luser