http://qs321.pair.com?node_id=1035969


in reply to example in book of Programming Perl does not work.

You wrote a wrong "-" symbol:
$ LC_ALL=C perl -E'my $pid = open(STDOUT, "|–") // die $!' # your quot +e No such file or directory at -e line 1. $ perl -E'my $pid = open(STDOUT, "|-") // die $!' # entered via keyboa +rd $
Perl does not consider "–" (chr(8211)) to be a dash ("-", chr(45)), so special open behaviour does not work in this case.

Replies are listed 'Best First'.
Re^2: example in book of Programming Perl does not work.
by yangy (Novice) on May 30, 2013 at 08:51 UTC
    thanks, I copy that char from pdf, now I change it to -,it work perfect now.

      I wonder if there is a way to submit an errata to the publisher. Is there source code included along with the PDF file that would be more appropriate to use?

      <muse>I understand that typesetting has its own needs, but I wonder if there is any way to have the best of both worlds in a case like this.</muse>

      --MidLifeXis

        I found it. source code of Programming Perl in oreilly web site. http://examples.oreilly.com/9780596004927/
Re^2: example in book of Programming Perl does not work.
by derby (Abbot) on May 30, 2013 at 12:43 UTC

    That blasted unicode 'en-dash' is the bane of my existence. I know I should pray for patience but most of the time I pray for the hastening schadenfreude that *will* befall the designers who think their dashes deserve to be special.

    -derby