By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,693 Members | 1,972 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,693 IT Pros & Developers. It's quick & easy.

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

P: 51
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,
Jul 15 '08 #1
Share this Question
Share on Google+
5 Replies


numberwhun
Expert Mod 2.5K+
P: 3,503
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
Jul 15 '08 #2

P: 51
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
Jul 16 '08 #3

numberwhun
Expert Mod 2.5K+
P: 3,503
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
Jul 16 '08 #4

P: 51
thanks for the help.
Jul 16 '08 #5

nithinpes
Expert 100+
P: 410
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.