use strict; use Data::Dump qw(dump); my @chars = ("A", "H", "\x0A"); my @found; foreach my $c (@chars) { @found = $c =~ /^([A-G])*$/; dump @found; } __END__ "A" () undef