I am working on the match functionality and have come up with a problem. Below is code and error:
print "Enter a string: "; chomp(my $_ = <STDIN>); 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"; }
And here is the error:
Uncaught exception from user code Unmatched [ in regex; marked by <-- HERE in m/([ <-- HERE B|b) +/ at Exercise_7_4.pl line 24.
TIA The Catfish
In reply to match function by catfish1116
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |