in reply to Matching strings differing by a number of periods

The join statement in the test matches non-period data and joins it back together before it is matched as normal.
#! /usr/bin/perl use strict; use warnings; my $lookfor = "xyz123abc"; while (<DATA>) { chomp; print "$_ matched\n" if join('', /([^\.]+)/g) =~ /^$lookfor$/; } __DATA__ xyz123abc xy.z123abc xyz1.23.abc xyz123abc1