in reply to Re: Interactive perl
in thread Interactive perl

That's just ugly. I use perl -wlne'eval;print$@if$@' (which doesn't print out the result of the eval; if I wanted that, I might do perl -wlne'print eval//$@//""').

Replies are listed 'Best First'.
Re^3: Interactive perl
by tlm (Prior) on Mar 23, 2005 at 16:28 UTC

    That's just ugly.

    Ugly? It's true that one doesn't automatically get a printout of the last expression evaluated (one has to ask for it with p or x or print, etc.), but getting readline/history, trace mode option, and the joy of x alone makes this well worth it, IMO.

    BTW, I'm not sure what you had intended with

    perl -wlne'print eval//$@//""'
    but it bombs:
    % perl -wlne 'print eval//$@//""' Warning: Use of "eval" without parentheses is ambiguous at -e line 1. Scalar found where operator expected at -e line 1, near "//$@" (Missing operator before $@?) syntax error at -e line 1, near "//$@" Search pattern not terminated at -e line 1.

    the lowliest monk