Title: RE: defining 'constants' at run time

> BEGIN {
>     # set "Constants" equal to first three command line arguments
>     eval <<EOF;
>     sub ARG1{"$ARGV[0]"}
>     sub ARG2{"$ARGV[1]"}
>     sub ARG3{"$ARGV[2]"}
> EOF
> }
>
> You have to do your setup runtime time before the code to be
> optimized
> is seen even once.

Doesnt that need to be

BEGIN {
    # set "Constants" equal to first three command line arguments
    eval <<EOF;
    sub ARG1(){"$ARGV[0]"}
    sub ARG2(){"$ARGV[1]"}
    sub ARG3(){"$ARGV[2]"}
EOF
}

And really

use constant ARG1=>$ARGV[0];
..

is better no?

yves

Reply via email to