print "Enter a string: "; chomp(my $_ = ); if ($_ = /([A|a])/) { my $afterstring = $'; print "This is the after string $afterstring\n"; if( $afterstring = /([B|b)/ ) { print The string has an a but also a following b\n"; } else { print "The string has an a , but not a following b\n"; } } else { print "String did not match\n"; } #### Uncaught exception from user code Unmatched [ in regex; marked by <-- HERE in m/([ <-- HERE B|b)/ at Exercise_7_4.pl line 24.