looking for perl synonym to #define in C/C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zcabeli
    New Member
    • Jan 2008
    • 51

    looking for perl synonym to #define in C/C++

    Hello,
    i'm looking for the equivalent perl symbol that match #define in C/C++
    anybody have an idea if any such feature exists ...

    thanks,
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    If I remember right, #define is a way of defining a subroutine in C++. If that is the case, then the 'sub' keyword is what you are looking for.

    Regards,

    Jeff

    Comment

    • zcabeli
      New Member
      • Jan 2008
      • 51

      #3
      Hi,

      #define used as macro in C. it's simply replace the first argument with the string represented by the second argument. format type is as follows :

      definition :
      #define ABC(X,Y,Z) BLA(X) + BLA(Y) + BLA(Z)
      #define FIVE 5

      usage :
      ABC(5,2,1) = BLA(5) + BLA(2) + BLA(1)
      x = 1 + FIVE

      Comment

      • numberwhun
        Recognized Expert Moderator Specialist
        • May 2007
        • 3467

        #4
        One of my fellow colleagues will correct me if I am wrong, but I don't think there is anything similar to that in Perl. Like I said, you could create a subroutine that does what you expect, but I don't know if what you want is available. Then again, not knowing C/C++, comparison is somewhat hindered, sorry.

        Regards,

        Jeff

        Comment

        • zcabeli
          New Member
          • Jan 2008
          • 51

          #5
          thanks for the help.

          Comment

          • nithinpes
            Recognized Expert Contributor
            • Dec 2007
            • 410

            #6
            You can have a look at Text::Macroscri pt module which provides macro pre-processor.

            Comment

            Working...