[comp.lang.perl] Piping input to output of a program through a Perl filter

CFGROB@weizmann.weizmann.ac.il (05/30/91)

I would like to make a Perl program that handles a ftp session.
That is, it should invoke ftp, answer the prompts, etc. I was trying
to figure out how to open pipes to the ftp program from within
program, but unsuccessfully. One problem seems to be that the
prompts in ftp are (obviously) given without a "\n" at the
end.

So here is the challange:
  A program which invokes ftp, logs in anonymously at a site
  given by $ARGV[0], perlforms ls, and get's any
  (all?) README, readme, read.me, files at the site.

I know there is a different solution, which was presented a while
ago in the Perl Digest, where the perl program itself handles
the TCP sockets. Unfortunately I lost this program. If someone
could tell me where to get this program on anonymous ftp,
I would very much appreciate it.

Regarding the patch to come in Perl I still think it would have
been cleaner to split //g into two different switches as was
suggested
     /$pat/g    returning the number of $pat matching
     /$pat/n    being the iterator

True that the number of matches can easily be calculated by a
while loop, but 1. I am lazy (that's why I am using Perl to begin
  1. I am lazy (that's why I am using Perl to begin with)
  2. The resul would be more consistent with s/// which returns
     the number of matches.
  3. It would remove a loop and thus some obscurity

eval("p"."r"."i"."n"."t"." ".'"'."J"."u"."s"."t"." "."a"." "."p"."l".
     "a"."n"." "."v"."a"."n"."i"."l"."l"."a"." "."p"."e"."r"."l"." ".
     "h"."a"."c"."k"."e"."r".",".'"'.";");
-------------
Dov Grobgeld
Department of Chemical Physics
The Weizmann Institute of Science
Israel