Loading ...
Sorry, an error occurred while loading the content.

Perl command line problem

Expand Messages
  • diyingyun2016@yahoo.cn
    Hi , I m starting Perl , just a fully fresh beginner ; And I use Perl command line in windows ; when I typed the command :¡¡perl -e print Hello,world n
    Message 1 of 4 , Sep 18, 2011
    • 0 Attachment
      Hi , I'm starting Perl , just a fully fresh beginner ;
      And I use Perl command line in windows ;
      when I typed the command :¡¡perl -e 'print "Hello,world\n"'
      However, a problem occurs that
      Can't find string terminator "'" anywhere before EOF at -e line 1.

      How should it happen , and I've checked for a long time , I need your help!
    • Chankey Pathak
      Use semicolon at the end. perl -e print hello ; works fine.
      Message 2 of 4 , Sep 18, 2011
      • 0 Attachment
        Use semicolon at the end.
        perl -e "print 'hello'";
        works fine.
        --- In perl-beginner@yahoogroups.com, "diyingyun2016@..." <874827643@...> wrote:
        >
        > Hi , I'm starting Perl , just a fully fresh beginner ;
        > And I use Perl command line in windows ;
        > when I typed the command :¡¡perl -e 'print "Hello,world\n"'
        > However, a problem occurs that
        > Can't find string terminator "'" anywhere before EOF at -e line 1.
        >
        > How should it happen , and I've checked for a long time , I need your help!
        >
      • Shawn H Corey
        ... If you re on Windows, you need to use double quotes instead of single quotes and escape the double quotes inside: C: perl -e print Hello, world n --
        Message 3 of 4 , Sep 18, 2011
        • 0 Attachment
          On 11-09-18 07:37 AM, diyingyun2016@... wrote:
          > Hi , I'm starting Perl , just a fully fresh beginner ;
          > And I use Perl command line in windows ;
          > when I typed the command :¡¡perl -e 'print "Hello,world\n"'
          > However, a problem occurs that
          > Can't find string terminator "'" anywhere before EOF at -e line 1.
          >
          > How should it happen , and I've checked for a long time , I need your help!

          If you're on Windows, you need to use double quotes instead of single
          quotes and escape the double quotes inside:

          C:> perl -e "print \"Hello, world\n\""


          --
          Just my 0.00000002 million dollars worth,
          Shawn

          Confusion is the first step of understanding.

          Programming is as much about organization and communication
          as it is about coding.

          The secret to great software: Fail early & often.

          Eliminate software piracy: use only FLOSS.

          "Make something worthwhile." -- Dear Hunter
        • timothy adigun
          Hi, ... help! C: perl -e print Hello World n will work fine, but On Windows OS, cmd shell does not treat single quote ( ) as a quote, so double quote ( )
          Message 4 of 4 , Sep 18, 2011
          • 0 Attachment
            Hi,

            --- In perl-beginner@yahoogroups.com, "diyingyun2016@..." <874827643@...>
            wrote:
            > Hi , I'm starting Perl , just a fully fresh beginner ;
            > And I use Perl command line in windows ;
            > when I typed the command :¡¡perl -e 'print "Hello,world\n"'
            > However, a problem occurs that
            > Can't find string terminator "'" anywhere before EOF at -e line 1.
            > How should it happen , and I've checked for a long time , I need your
            help!


            C:\>perl -e 'print "Hello World\n"'
            will work fine, but On Windows OS, cmd shell does not treat single quote (')
            as a quote,
            so double quote (") should be used after '-e' on the command Line Interface
            like this:
            C:\>perl -e "print 'Hello World'"
            However, one can use 'qq' operator in perl to do a good job like this:
            C:\>perl -e "print qq{Hello World\n}"

            Regards.
            --
            Tim


            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.