#! /usr/bin/perl -wl use strict; while( ) { chomp; print "$_ ", /^(19[5-9]\d|20([0-4]\d|50))$/ ? 'ok' : 'nok'; } __DATA__ 1949 1950 1951 1999 2000 2001 2010 2049 2050 2051 2102 22102 19534 19080 20010