Simple Perl Syntax Question

Discussion in 'Programming' started by gobbly2100, May 21, 2008.

  1. #1
    Hey,

    Which of the following is the correct syntax for Perl scripts?

    print "Hello World";
    Code (markup):
    Or

    print ("Hello World");
    Code (markup):
    Basically I am not sure if you need the brackets or not as both methods work and different resources say different so now I am confused.

    Thanks in advance!
     
    gobbly2100, May 21, 2008 IP
  2. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #2
    First one , in perl bracket is not required or rather will give syntax error.
     
    it career, May 23, 2008 IP
  3. JRBHosting

    JRBHosting Peon

    Messages:
    121
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It depends on the version of PERL that you are running. In some (I forget which), both of those will work.

    Jason
     
    JRBHosting, May 25, 2008 IP