budman has asked for the wisdom of the Perl Monks concerning the following question:
Can the map or regex substitute command take the sign value and apply it to the remainder of the array?perl -le '@B=qw(-0 4);$g=($B[0] lt 0?-1:1); printf"%s\n" x 3,$B[0],$g,$B[1]*$g' -0 -1 -4 perl -le '@B=(-0,4);$g=($B[0] < 0?-1:1); printf"%s\n" x 3,$B[0],$g,$B[1]*$g' 0 1 4
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Applying Sign Bit
by mattr (Curate) on Jan 22, 2004 at 09:17 UTC | |
|
Re: Applying Sign Bit
by Abigail-II (Bishop) on Jan 22, 2004 at 09:42 UTC | |
|
Re: Applying Sign Bit
by Anonymous Monk on Jan 22, 2004 at 14:12 UTC | |
|
Re: Applying Sign Bit
by hardburn (Abbot) on Jan 22, 2004 at 14:43 UTC | |
by Anonymous Monk on Jan 22, 2004 at 17:52 UTC | |
by demerphq (Chancellor) on Jan 23, 2004 at 19:48 UTC | |
|
Re: Applying Sign Bit
by jdtoronto (Prior) on Jan 22, 2004 at 14:58 UTC | |
by Abigail-II (Bishop) on Jan 22, 2004 at 15:09 UTC | |
by budman (Sexton) on Jan 23, 2004 at 03:55 UTC | |
by Anonymous Monk on Jan 23, 2004 at 17:38 UTC |