in reply to asigning a grep statment to a variable

Apart from suaveant's response, note that this is not the most efficient or portable way of doing the search. Which may be OK if this is quick script, but may not if it's intended to be a production program, or to run in multiple platforms.

One Perl-only way of doing it could be like this:

open(F, "/user/telalert/telalert.trail") or die "Error: $!\n"; @TTRAILS=grep /\]Send Started/, <F>; close(F);
You could join @TTRAILS together if you want a single string, which is what the grep command would return.

I'm not sure if the grep on <F> will read the whole thing in memory at once or if it is intelligent enough to read it line by line, which could make a difference if the file is very large.

--ZZamboni