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:

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; }
TIMTOWDI, but this is a simple way to print lines between "NAME" and "SYNOPSIS".

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


In reply to Re: script debug by VSarkiss
in thread script debug by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.