http://www.perlmonks.org?node_id=1057568


in reply to Substrings of unusual size!

If I'm understanding you correctly, you need the =~ operator but haven't done much with regular expressions yet. perlretut should help.