use strict; use warnings; my $hello = "\n |\t\r"; if ($hello =~ m/^[ \|\t\r\n]+$/){ print "yep this matches"; } else { print "no this doesn't match"; } exit;