Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!samsung!spool.mu.edu!agate!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal L. Schwartz) Newsgroups: comp.lang.perl Subject: Re: using perl interactively Message-ID: <1991May22.163523.2939@iwarp.intel.com> Date: 22 May 91 16:35:23 GMT References: Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal L. Schwartz) Distribution: comp Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 38 In-Reply-To: mayer@sono.uucp (Ronald &) In article you write: | Has anyone written a good interface for using perl interactively? There are two. "perlsh" is buried in the distribution, which I quote here irreverently: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% quote #!/usr/bin/perl # Poor man's perl shell. # Simply type two carriage returns every time you want to evaluate. # Note that it must be a complete perl statement--don't type double # carriage return in the middle of a loop. $/ = ''; # set paragraph mode $SHlinesep = "\n"; while ($SHcmd = <>) { $/ = $SHlinesep; eval $SHcmd; print $@ || "\n"; $SHlinesep = $/; $/ = ''; } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end quote The other, which I use frequently, is to invoke: perl -de 0 which invokes the debugger on the one-line Perl program "0". Once you are in the debugger, it's trivial to type in Perl expressions to be eval'ed. And you even get a history feature and aliases that way. :-) echo 'c' | perl -de 'print "Just another Perl hacker,"' # ugh. :-) -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/