You show that both programs compile to the same thing. However, compilation time is a definite issue for a scripting language. If filtering with <samp>cpp</samp> compiles twice as quickly as using a <samp>constant</samp>, then it is faster for short-lived programs.
To determine run time of a program, use one of the UN*X <samp>time</samp> commands (either the shell builtin or <samp>/usr/bin/time</samp> or <samp>/usr/bin/timex</samp>). This should give equivalent results to the suggestion given above for using <samp>Benchmark</samp>.
However, almost surely it does not matter: for very many Perl programs, the compile time is dominated by the run time. Exceptions may include some CGI programs (and hence e.g. <samp>mod_perl</samp>, which seeks to reduce the number of times compilation time is paid).
In reply to Re: Re: Preprocessor Pranks
by ariels
in thread Preprocessor Pranks
by cmilfo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |