in reply to Re: Nervously....How do I access the Name of a Perl variable?
in thread Nervously....How do I access the Name of a Perl variable?

Well, perl does have the -p option which will throw your Perl program through the C preprocessor....

You have to be careful though, as the # character also starts a Perl comment.

Abigail

  • Comment on Re: Nervously....How do I access the Name of a Perl variable?

Replies are listed 'Best First'.
Re: Re: Nervously....How do I access the Name of a Perl variable?
by jmcnamara (Monsignor) on Jun 11, 2002 at 10:35 UTC

    Here is a simple example using -P. The program should be run as follows perl -P program.pl and it requires a pre-processor on the target system:
    #!/usr/bin/perl -w use strict; #define TRACE(x) print "$0 line ". __LINE__ .":\t". x ." = ". eval +(x). "\n"; my $foo = 7; TRACE('$foo'); $foo *= $foo; TRACE('$foo'); __END__ Prints: /tmp/test.pl line 8: $foo = 7 /tmp/test.pl line 11: $foo = 49

    --
    John.