Your skill will accomplish
what the force of many cannot
Weird (?) behavior with constants under special conditionsby ceo (Acolyte)
|on Jan 31, 2013 at 14:04 UTC||Need Help??|
ceo has asked for the
wisdom of the Perl Monks concerning the following question:
I had no chance of getting PPI installed in our environment, so I wrote a small perl-parser which does kind of okay in most cases we got here. Of course, its not as mighty as PPI, but that isnt neccessary anyway. But that isnt the topic, just somekind of bad introduction.
So, I just stumbled upon this:
You can say, let's say...
use constant g => 30;
and "print g" will print "30". Allright...
So, what if you are trying to print g divided by 5?
prints 6, so, it works fine.
But what if you are going to try define another constant, named s, and try to print it, divided by 5, divided by 20, divided by g?
That doesnt work. It always tries to do a substition regex on $_, and I, of course, understand why.
But... is there no way to get the result of s divided by 5 divided by 20 divided by g, when s and g are constants? And is that really wanted?