in reply to Parsing (l)unix man pages

Your problem is the control characters. Try the following:
my $cmd = "/usr/bin/man ssh"; open(MAN, "$cmd |") or die "Cannot run command '$cmd': $!"; while (<MAN>) { s/\010.//g; print "Worked!\n" if /ssh/; }
The \010 is the octal escape sequence for character 8. You can double-check the presence of character 8 by:
man ssh |perl -ne 'print "$&:", ord($&), "\n" while /./g' | less

Replies are listed 'Best First'.
Re: Re (tilly) 1: Parsing (l)unix man pages
by Anonymous Monk on Aug 21, 2001 at 22:22 UTC
    Thank you all :)