#!/bin/perl -w use strict; my $re = qr/\S{8}$/; my $input=""; until ($input=~m/$re/) { $input=; chomp $input; } #### #./retest 1234 12345678 #./retest 123456789 #