http://qs1969.pair.com?node_id=361035

If this had been a real emergency....
#!/usr/bin/perl open (X,$0);X([<X>]);sub X{$x=shift;print pack("C*", map{s|X|**|g;s|x|*|g;eval;}(split(/\|/,join("", map{s|\#||;eval}(grep/x/,(grep/^\#/,@$x))))));} #$x="2x37|13x3X2|23x5|29x2X2|2X5|5x13|5x2x11|3x37|29x2X2|13x2X3|101|19 +x3x2"; #$x="|2X5|2X4x5|101|19x3x2|3X3x2X2|2X5|2X3x3X2|97|3X2x11|107|101|19x3x +2";

For those of you with old versions of CGI.pm (eg no Vars method)

use CGI qw(param); my %hash= map{my $v=[param($_)];$_,$#$v>0?join ("\0",@$v):shift@$v}param();

Here's a way to break @ary into blocks of size $x; Also check to make sure you don't exceed the array length.

my $x=50; #blocksize foreach (my $i=0;$i<=int($#ary/50);$i++) { my $end = ($x*$i+$x-1>=$#ary?$#ary:($x*$i+$x-1); my @keep = @ary[$i*$x..$end]; # Do stuff with @keep }
I had to resort an array, like this graphical representation:

Original

1 2
3 4
5 6
7 8

EG:(1..8)

TO

1 5
2 6
3 7
4 8

EG:(1,5,2,6,3,7,4,8).

my @sorted; my @array=(0..10); @first = splice (@array, 0, int(($#array+2)/2)); @sorted=map{(shift @first, shift @array)}(0..$#array); push (@sorted, shift @first) if ++$#first;

<code> #!/usr/bin/perl main("quick","brown","fox"); sub main { my $str = "harry.is.brown\n"; my $k=split(/(.)/,$str);#split/./,list context resolves to @_="\n"; print @_; #split /\./,$str; } my $ctr='a'; print $ctr++ . "\n" foreach (1..26); You can also do things like 'aa'..'zz'.