467,146 Members | 1,018 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,146 developers. It's quick & easy.

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

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

Jul 15 '08 #1
  • viewed: 2981
5 Replies
Expert Mod 2GB
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.


Jul 15 '08 #2

#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
Jul 16 '08 #3
Expert Mod 2GB
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.


Jul 16 '08 #4
thanks for the help.
Jul 16 '08 #5
Expert 256MB
You can have a look at Text::Macroscript module which provides macro pre-processor.
Jul 17 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Xah Lee | last post: by
reply views Thread by gary artim | last post: by
3 posts views Thread by Pat Deegan | last post: by
4 posts views Thread by banz@glion.ch | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.