I have oogled and googled but I can't spot why I am getting an error when I run this program

use Expect; # use strict; # commented out to allow program to run for now # Spawn program using perl expect module my $exp = Expect->spawn($run_program) or die "Cannot spawn $run_program: $!\n"; # Turn off output of results from stdout $exp->log_stdout(1); # Wait for runrep to initialise $exp->expect(600,[ qr/Read in all files/]); $exp->send("runprogram $report_name $output_format \n"); # Wait for report to run or generate an error $exp->expect(600, [ qr/Error/i, sub { my $self = shift; $self->send("quit\n"); print ("program.pl has an error: $_ \n"); exp_continue; }], # *** [ qr/Report run successful./i, sub { my $self = shift; $self->send("quit\n"); exp_continue; }]);} # ***

I get the following error:

Bareword "exp_continue" not allowed while "strict subs" in use at perlscript.pl line 418.
(which is marked with ***)
Which is the -- exp_continue; }], -- line

When I take out the first sub part the error just appears in the next line containing exp_continue # ***

The print function doesn't have any effect on curing this error.

The code works when I comment out the use strict line, but this is bad and I would prefer to fix this error and keep using use strict.

My question is can any one spot any errors that might cause the code to give out the error. Is it obvious.?
Or can any one suggest a better use of the
# Wait for report to run or generate an error
part of the expect module

When I use diagnostics I get some more information

Bareword "exp_continue" not allowed while "strict subs" in use at perlscript.pl line 421.
perlscript.pl had compilation errors (#1)
(F) With "strict subs" in use,
a bareword is only allowed as a subroutine identifier, in curly brackets or to the left of the "=>"symbol.
Perhaps you need to predeclare a subroutine?

Uncaught exception from user code:
Bareword "exp_continue" not allowed while "strict subs" in use at perlscript.pl line 421.
perlscript.pl had compilation errors.


In reply to expect module: exp_continue error by chime

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.