#!/usr/env/perl use strict; use warnings; my $q = (shift or 129); # 128 is the largest working value my @x = ( 'A' x $q, 'B' x $q ); my $glob = '{' . join(',', @x) . '}'; while (my $g = glob($glob)) { print "while: $g\n"; } for my $g ( glob( $glob ) ) { print "for: $g\n"; } __EOF__ ################# # result: # while: for: