kp2a has asked for the wisdom of the Perl Monks concerning the following question:
Why should I not be surprised that the code below prints 2 and not 4?
File two.pl
File two.pl
#! /usr/bin/perl -w use strict; sub two {2} printf "two + 2 = %d\n",two + 2; john@scan test$ ./two.pl two + 2 = 2 testing: printf "%d\n",two; prints 2
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: two + 2 not equal 4!
by toolic (Bishop) on Jul 24, 2010 at 02:09 UTC | |
Re: two + 2 not equal 4!
by BrowserUk (Patriarch) on Jul 24, 2010 at 03:00 UTC | |
Re: two + 2 not equal 4!
by sierpinski (Chaplain) on Jul 24, 2010 at 02:13 UTC | |
Re: two + 2 not equal 4!
by ikegami (Patriarch) on Jul 24, 2010 at 13:31 UTC | |
Re: two + 2 not equal 4!
by nvivek (Vicar) on Jul 24, 2010 at 05:28 UTC | |
Re: two + 2 not equal 4!
by morgon (Priest) on Jul 24, 2010 at 02:05 UTC | |
by toolic (Bishop) on Jul 24, 2010 at 02:36 UTC | |
Re: two + 2 not equal 4!
by suhailck (Friar) on Jul 24, 2010 at 06:15 UTC |
Back to
Seekers of Perl Wisdom