#!/usr/bin/perl -w use constant minUC => 3; my $min = 3; my $test = "AAAAAA"; my @chars = (split //, $test); my $Rep = 0; foreach my $c ( @chars) { $Rep++ if ($test =~ /$c{3,}?/) ; # this works # $Rep++ if ($test =~ /$c{$min,}?/) ; # no work; # $Rep++ if ($test =~ /$c{minUC,}?/) ; #nor does using a named constant }