in reply to script debug
Hi, Anonymous Monk. It looks like this is a continuation to this previous question. Is it? You haven't really said what the problem is -- "this won't work" is a pretty broad problem statement -- but assuming you're the same person, working on the same problem, then maybe some suggestions are in order.
First, you're accumulating lines in memory and not doing anything with them. If you're expecting some output, a print or something similar is necessary. Second, there's no real point collecting lines in memory if all you're going to do is copy them out verbatim. So, as a first cut, I suggest this transformation:
TIMTOWDI, but this is a simple way to print lines between "NAME" and "SYNOPSIS".open (MAN, "/usr/bin/man ssh |"); my $printing_on = 0; # If true, print what you see while (<MAN>) { s/^\s+//g; # if you like; could be omitted. if ($_ eq "NAME\n") # constant string; no regexp needed { $printing_on = 1; } elsif ($_ eq "SYNOPSIS\n") { exit; # we're done } print if $printing_on; }
I'm using the ESP::Telepathy module a lot without knowing your intentions, so I'll stop here. Please provide a little more detail about what "won't work" means, and you should get a better answer.
HTH
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: script debug
by faure (Sexton) on Aug 19, 2001 at 02:01 UTC |