in reply to Re: Adding 2 + 2
in thread Adding 2 + 2
That's really an interesting way of getting 1, not 2. Other interesting ways to get 1:
my $one = !@!; my $one = !!$]; my $one = /.*/; # Side-effect: Changes $1, etc my $one = $$/$$; my $one = ()=$$; my $one = @{[$$]}; my $one = 'a'^'P'; # Character set specific. my $one = ord('b')-ord('a'); # Character set specific.
And 2:
my $two = $one+$one; my $two = $one<<$one; my $two = ()=qw(a a); my $two = @{[ qw(a a) ]}; my $two = ()=/(.*)(.*)/; # Side-effect: Changes $1, etc my $two = 'a'^'S'; # Character set specific. my $two = ord('c')-ord('a'); # Character set specific.
None of these have side effects unless otherwise noted.
All of these run under use strict;.
All of these run silently under use warnings;.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Adding 2 + 2 (digit-less 1)
by ambrus (Abbot) on Jan 31, 2007 at 10:15 UTC | |
|
Re^3: Adding 2 + 2 (digit-less 1)
by vrk (Chaplain) on Mar 04, 2007 at 15:26 UTC |