Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!uunet!mcsun!hp4nl!mhres!jv From: jv@mh.nl (Johan Vromans) Newsgroups: comp.lang.perl Subject: StreamPerl (Was Re: Randal's one-liners) Message-ID: Date: 9 Mar 90 18:02:39 GMT Sender: news@mhres.mh.nl Organization: Multihouse Gouda, the Netherlands Lines: 48 In-reply-to: lwall@jpl-devvax.JPL.NASA.GOV's message of 8 Mar 90 23:48:18 GMT I found the following perl program very helpful in exercizing Randal's one-liners: #!/usr/bin/perl eval "exec perl -S $0 $*" if $running_under_some_shell; # # StreamPerl - execute perl program from standard input # ($version,$patchlevel) = $] =~ /(\d+.\d+).*\nPatch level: (\d+)/; print "StreamPerl version $version, patchlevel $patchlevel\n"; $prog = "/usr/tmp/spl$$"; open (TMP, ">$prog") || die "Cannot create $prog, stopped"; print TMP while ; close TMP; do $prog; unlink ($prog); In addition, the following program, based on the idea of a perl shell, has proven very helpful on trying perl: #!/usr/local/bin/perl eval "exec perl -S $0 $*" if $running_under_some_shell; ($version,$patchlevel) = $] =~ /(\d+.\d+).*\nPatch level: (\d+)/; print "Interactive Perl version $version, patchlevel $patchlevel\n"; $Prompt = 'perl> '; $Printing = "\n"; print $Prompt; while () { $Pres = eval $_ . ';'; print $Pres.$Printing if $Printing; print $@; print $Prompt; } Johan -- Johan Vromans jv@mh.nl via internet backbones Multihouse Automatisering bv uucp: ..!{uunet,hp4nl}!mh.nl!jv Doesburgweg 7, 2803 PL Gouda, The Netherlands phone/fax: +31 1820 62944/62500 ------------------------ "Arms are made for hugging" -------------------------