Re: using perl interpreter interactively like python?
Jeff Kowalczyk wrote: I'd like to open perl and execute a few commands interactively in the console. I learn a lot in python this way, and I need to understand some perl code. Did this kind of thing ever get added to perl? yes but probably not in a sense that you expect it. the perl debugger can be involved to work like an interactive Perl environment: [panda]# perl -de 1 ... [snip a few lines] ... main::(-e:1): 1 DB1 at the DB1 prompt, you can eneter anything you want. if it's not recognized by the debugger, it's passed directly to eval so you can do stuff like: DB1 print hello world\n hello world DB3 use strict; DB4 use warnings; DB5 sub sum{ \ cont: my $sum = 0; \ cont: $sum += $_ for(@_); \ cont: $sum; } DB6 print sum(1..5),\n; 15 DB7 q [panda]# 'q' will exit the debugger. lines ends with '\' signal the debugger to grab the next line. it's a little unusually to use the debugger for an interactive Perl session but it's capable of doing it. perldoc perldebug david -- s,.*,,e,y,\n,,d,y,.s,10,,s .ss.s.s...s.sss.s.ss s.s.s...s...s..s ...s.ss..s.sss..ss.sss.s s.s.s...ss.sss.s ..s..sss.s.ss.sss... ..ssss.sss.sss.s ,{4},|?{*=}_'y!'+0!$; ,ge,y,!#:$_(-*[./[EMAIL PROTECTED],b-t, .y...,$~=q~=?,;^_#+?{~,,$~=~ y.!-*-/:[EMAIL PROTECTED] ().;s,;, );,g,s,s,$~s,g,y,y,%,,g,eval -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using perl interpreter interactively like python?
From: Jeff Kowalczyk [EMAIL PROTECTED] I'd like to open perl and execute a few commands interactively in the console. I learn a lot in python this way, and I need to understand some perl code. Did this kind of thing ever get added to perl? Apart from the debug session explained in the previouw reply there is nothing buitin, but it's all to easy to crate your own interactive prompt. See http://Jenda.Krynicky.cz/#PSH Jenda = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz = When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using perl interpreter interactively like python?
On Thu, 2003-11-20 at 14:25, Jeff Kowalczyk wrote: I'd like to open perl and execute a few commands interactively in the console. I learn a lot in python this way, and I need to understand some perl code. Did this kind of thing ever get added to perl? I assume you're talking about how you can type $ python and enter whatever you want into python, and have it execute when you hit control-D. The same thing works in Perl, just type $ perl -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using perl interpreter interactively like python?
On Thursday, Nov 20, 2003, at 11:25 US/Pacific, Jeff Kowalczyk wrote: [..] I'd like to open perl and execute a few commands interactively in the console. I learn a lot in python this way, and I need to understand some perl code. Did this kind of thing ever get added to perl? [..] first off compliments to the previous responders, there is the minor 'glitch' with the 'just use per' namely I can't quite get the AUTOFLUSH to send output, [jeeves: 9:] perl my $i=3; my $j = 4; my $k = $i + $j; print k is $k\n; k is 7 [jeeves: 10:] that print statement did not come out till I did the ^D even when I tried the traditional $|=1; So I'd like to recommend my standard alternative, namely have a couple of basic templates for basic shell script structures and 'whip out the idea' and see if it flies. I use BBedit on a Mac running OSX so it's painfully simple for me, it has a 'run' button that will allow me to 'just execute it'. but I use to do that the old fashion way with vi on *nix boxes. { where one had the file in vi in one window, editing, and another window where one did the !./ - to 'rerun' the previously locally executed command... } That is also what drives me to 'think' in terms of sub some_subname_here { my () = @_; . } Since I can play with an idea, if it is really usefulish, it is already nested in a 'sub', and then it is merely a matter of finding a 'home' for it in some appropriate Perl Module... Your mileage may vary, consult a physician, void where prohibited by law, etc, etc, etc... ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]