#!/usr/bin/perl use strict; use warnings; while () { chomp; printf "%d %s\n", $_, /^(\d{1,3})${\($1 > 255 ? qr(^) : qr($))}/ ? "matches" : "fails"; } __DATA__ 3 100 333 200 Use of uninitialized value in numeric gt (>) at XXX line 9, line 1. 3 matches 100 matches 333 matches 200 fails