No such thing as a small change PerlMonks

### Re: TMTOWTDI Puzzle: Generating a range of numbers

by wog (Curate)
 on Dec 19, 2001 at 04:38 UTC ( #132987=note: print w/replies, xml ) Need Help??

(update: the first one has been edited to fix problems/bad style since I first pressed submit. Oopsie.)

```use strict;
my @result;
my \$one = "a" =~ /./;

my(\$vA,\$vB) = @_;
(\$vA,\$vB) = (\$vA^\$vB,(\$vA&\$vB)<<\$one) while \$vB;
return \$vA;
}

my \$val = \$one;
do {
push @result, \$val;
} until \$one.\$one eq \$val;

... or, without any lines preceeding it in the file it's in ...

```sub f {  die if \$::f_A;
die if \$::f_B;
die if \$::f_C;
die if \$::f_D;
die if \$::f_E;
die if \$::f_F;
die if \$::f_G;
die if \$::f_H;
die if \$::f_I;
die if \$::f_J; }
my @vars = map { "::f_\$_" } qw(A B C D E F G H I J);

my @result;

foreach (@vars) {
\$\$_ = "true";
eval { f() };
push @result, \$@ =~ /line ([^.]+)\./;
\$\$_ = undef;
}

update: A very, very cheap solution: (doesn't work on EBCDIC systems, sorry)

```my @result = split " ", "pasarauatawavayaxapq"^"AAAAAAAAAAAAAAAAAAAA";

Create A New User
Node Status?
node history
Node Type: note [id://132987]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2021-01-17 19:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
The STEM quote I most wish I'd made is:

Results (174 votes). Check out past polls.

Notices?