How can I use macros in Perl?

前端 未结 4 1320
一生所求
一生所求 2021-01-01 05:36

How do I use macros in Perl, like I do in C?

Example:

#define value 100 
print value; 

I want to get the output as 100.

4条回答
  •  旧巷少年郎
    2021-01-01 06:24

    Try the following:

    macro.pl

        use strict;
        use warnings;
        #define a 10;
        print a;
    

    And run this code using -P switch.

    Example: perl -P macro.pl

    And use the module Filter::cpp also.

提交回复
热议问题