while () { m/($insert_expected_symbol_format_here)/ or die "Bad input format"; # or maybe just "or next" my $symbol = $1; };