philiprbrenan has asked for the wisdom of the Perl Monks concerning the following question:
When I try:
#!/usr/bin/perl sub aa{2} sub bb{2} my ($a, $b) = (aa, bb); my ($s, $t) = ((2*aa+bb), (2*$a+$b)); say STDERR "$a==", aa; say STDERR "$b==", bb; say STDERR "$s==$t";
I get:
2==2 2==2 4==6
Please tell me what I am doing wrong, as I expected $s and $t to be equal
It can't be perl It must be me Yet what it is I cannot see
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Constant code
by toolic (Bishop) on Jan 20, 2017 at 15:33 UTC | |
|
Re: Constant code (prototype)
by LanX (Saint) on Jan 20, 2017 at 16:46 UTC | |
|
Re: Constant code
by hippo (Archbishop) on Jan 20, 2017 at 15:34 UTC | |
|
Re: Constant code
by Marshall (Canon) on Jan 20, 2017 at 16:21 UTC | |
by Anonymous Monk on Jan 20, 2017 at 21:00 UTC | |
by Anonymous Monk on Jan 20, 2017 at 22:15 UTC | |
by mpersico (Monk) on Jan 20, 2017 at 21:02 UTC | |
by AnomalousMonk (Archbishop) on Jan 20, 2017 at 23:04 UTC |