Thread RDW #2 - Rätsel der Woche Nr. 2 (155 answers)
Opened by renee at 2004-07-16 12:08

Taulmarill
 2004-07-19 15:57
#84474 #84474
User since
2004-02-19
1750 Artikel
BenutzerIn

user image
wenn man sort nicht benutzt sollte man auf jeden fall @a, $a benutzen, das ist eine interne variable und funktioniert desshalb auch unter use strict; ohne my. $x bzw @x müsste man erst mit my initialisieren.
Code: (dl )
1
2
3
4
5
6
7
8
9
10
> perl -s -e'print"{@a[grep$a&2**$_,0..@a]}"while$a++<2**(@a=qw/0 1 2/)'
{0}{1}{0 1}{2}{0 2}{1 2}{0 1 2}{}

> perl -Mstrict -e'print"{@x[grep$x&2**$_,0..@x]}"while$x++<2**(@x=qw/0 1 2/)'
Global symbol "@x" requires explicit package name at -e line 1.
Global symbol "$x" requires explicit package name at -e line 1.
Global symbol "@x" requires explicit package name at -e line 1.
Global symbol "$x" requires explicit package name at -e line 1.
Global symbol "@x" requires explicit package name at -e line 1.
Execution of -e aborted due to compilation errors.
$_=unpack"B*",~pack"H*",$_ and y&1|0& |#&&print"$_\n"for@.=qw BFA2F7C39139F45F78
0A28104594444504400 0A2F107D54447DE7800 0A2110453444450500 73CF1045138445F4800 0
F3EF2044E3D17DE 8A08A0451412411 F3CF207DF41C79E 820A20451412414 83E93C4513D17D2B

View full thread RDW #2 - Rätsel der Woche Nr. 2