Is there a reason you are using "tail -f" in your file handle, as opposed to "tail -n 10" or similar. In my system, the script hangs waiting for additional input to the file. Here's an alternative idea for you to consider:
my @list; my $file = q[/path/to/some/file]; my $regex = qr[your pattern]; open my $fh, "tail $file |" or die; while (<$fh>) { chomp; say "testing: $_"; push @list, $_ if ( $_ =~ $regex); last if (@list >= 2); } local $"="\n"; say "found: @list";
In reply to Re: Array size issue
by smile4me
in thread Array size issue
by hmb104
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |