Binding a regexp to a parameter in perl, I’m getting the following error:
syntax error at ./ctime.pl line 23, near "/^\((\d{2}):(\d{2})\)/)"
Execution of ./ctime.pl aborted due to compilation errors.
Here is the line where I try to bind it:
$_[0] =~ /^\((\d{2}):(\d{2})\)/)/;
I’m trying to match an hours/minutes combination in parens, such as (99:99 or (01:24). There will always be four digits.
should be
You accidentally duplicated two characters near the end of the line.
PS — As a note of caution, you’ll have problems if you try to pass
$1or the like as an argument to function that contains this code because you use$_[0]directly.