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