$ perl -E 'my $quant = 2; "ab" =~ /.{$quant}/ and say "Matched"' Matched