(Hope this is the right spot for this!)
Pythonists complain that Perl doesn't have an interactive mode, but of course you can easily make one. However other examples I have seen were 20 line scripts, a little while ago I made up this one liner (which I tend to stash in a minimal shell script called ip, on every machine I use):
perl -ne 'print join(",", eval),"\n> "'
(Of course half that is just for prettification, if you don't mind ugly you can just say
perl -ne 'print eval'.) It does pretty much everything you hope (provided your shell handles up arrow history for you). An example session:
./ip
$a=2
2
> $a**10
1024
> $a *= 3
6
> sprintf '%lx', ~$a
fffffff9
> use Digest::SHA 'sha256_hex'
> sha256_hex 10
4a44dc15364204a80fe80e9039455cc1608281820fe2b24f1e5233ade6af1dd5
> exit
Although also very useful for testing small confusions about syntax, I've found it so handy as a sort of super calculator that I now keep an instance running all the time.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.