Sharan Basappa wrote:
>
> I am using debugging for a program of mine.
>
> The debugger exits probably after a regex match fail. I am not sure
> why it should exit.
> Any ideas, clues?
>
> Regards
>
> main::(StTrAuto.pl:106): my @new_auto_tr = ();
> DB<2> s
> main::(StTrAuto.pl:107): foreach $temp (@auto_tr)
> main::(StTrAuto.pl:108): {
> DB<2> s
> main::(StTrAuto.pl:109): if($temp =~ m/^$start_state)/)
> main::(StTrAuto.pl:110): {
> DB<2> s
> Unmatched ) in regex; marked by <-- HERE in m/^0) <-- HERE / at
> StTrAuto.pl line 109.
> at StTrAuto.pl line 109
> Debugged program terminated. Use q to quit or R to restart,
> use O inhibit_exit to avoid stopping after program termination,
The error is delayed until run time because you have a variable interpolated
into your regular expression.
m/^$start_state)/
Your debugger has said, "Unmatched ) in regex," and although there would have
been no error if $start_state had an open parenthesis to match the literal one
in your regex, I think it's much more likely that you meant
m/^$start_state$/
or even better
if ($temp eq $start_state) {
:
}
I also think that you have not written
use strict;
use warnings;
at the start of your program, and anything that is presented to this list should
at least have those in place.
My final comment is that $temp is an awful name for a variable under almost any
circumstances.
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/