L
lihao0129
Hi, folks:
Is there a way in Perl to return the variable name instead of it's
values, like in C, we can use the '#' token with macro:
#define print_int(var) printf( #var " is %d\n", var)
then each time I want to print out an interger, I issue:
print_int(number);
instead of
printf("number is %d \n", number);
The output string might be very long and used for various variables,
so I need to wrap it into a subroutine or something else available for
this purpose. Can I do this with Perl? Many thank for your hints..
Best regards,
Lihao
Is there a way in Perl to return the variable name instead of it's
values, like in C, we can use the '#' token with macro:
#define print_int(var) printf( #var " is %d\n", var)
then each time I want to print out an interger, I issue:
print_int(number);
instead of
printf("number is %d \n", number);
The output string might be very long and used for various variables,
so I need to wrap it into a subroutine or something else available for
this purpose. Can I do this with Perl? Many thank for your hints..
Best regards,
Lihao