in reply to Is there any way to make an array non-greedy?

Did you mean to do this?

use strict; use warnings; my $string = join('x', ('a')x20); ### NOTE the ()'s print $string,$/; my (@foo, $foo); (@foo[0..18], $foo) = split('x', $string); print $foo[0],$/; print "Success!\n" if $foo eq "a"; __END__ axaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxaxa a Success!

I don't quite understand your  join('x', 'a'x20); otherwise. Why join a scalar?

cheers

SK