That's not what my code does, nor was I saying that $c was one thing at compile time and one at run time. This is what I do:
# init the app
sub _ { 'compile time '.@_};
my $compile = _(1);
sub foo { _(1) };
# finished compiling, so redefine sub _
sub _ { 'run time '.@_};
# run the code
my $run = foo();
print " $compile - $run\n"
__END__
compile time 1 - run time 1
UPDATE: Meant to reply to Re^5: How do I pretend a reference isn't a reference
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|