in reply to Printing Array with quote and comma

Hi,

In one line:

perl -e '@a = qw(book dog cat); print "[".join(",",@a)."];\n";'
--
if ( 1 ) { $postman->ring() for (1..2); }

Replies are listed 'Best First'.
Re^2: Printing Array with quote and comma
by reasonablekeith (Deacon) on Oct 05, 2005 at 09:53 UTC
    This doesn't work according to spec, you're missing the single quotes round each value.

    It also refuses to run in a windows command shell...

    Can't find string terminator "'" anywhere before EOF at -e line 1.
    ---
    my name's not Keith, and I'm not reasonable.

      Hi,

      well, in linux and cygwin on win 2000 (cmd.exe & bash) it does work...

      Are you sure you copied the complete line?

      --
      if ( 1 ) { $postman->ring() for (1..2); }