use strict; use warnings; my $start = 'zzy0'; #-- start including this 'number' my $end = 'zzz5'; #-- end including this 'number' my $set = '{' . join(',', 0..9, 'a'..'z') . '}'; #-- max. range is '0000' .. 'zzzz' for ( glob "$set$set$set$set" ) { print $_,"\n" if /$start/ .. /$end/; }