PERL - pressEnter function hanging
PERL - pressEnter function hanging
(OP)
Hi,
I have a sub function called pressEnter within my perl menu script which basically means that the script will await an interaction from the user before moving on.
Unfortunately when the script goes into pressEnter it just hangs (even if you press enter!!).
Any ideas on what could be causing this?
sub checkJob
{
system('clear');
print "The current Job Status is:\n\n";
`./scriptlist.ksh 2`;
open OUTPUT, "./output";
undef $/;
$_ = <OUTPUT>;
($var) = m/^(INTE.*PM)$/sm;
print "$var\n\n";
close OUTPUT;
pressEnter();
}
sub pressEnter
{
print "Press Return to continue\n\n";
$dummy = <>;
mainMenu();
}
I've included another sub function so you can see how it is called.
I have a sub function called pressEnter within my perl menu script which basically means that the script will await an interaction from the user before moving on.
Unfortunately when the script goes into pressEnter it just hangs (even if you press enter!!).
Any ideas on what could be causing this?
CODE
sub checkJob
{
system('clear');
print "The current Job Status is:\n\n";
`./scriptlist.ksh 2`;
open OUTPUT, "./output";
undef $/;
$_ = <OUTPUT>;
($var) = m/^(INTE.*PM)$/sm;
print "$var\n\n";
close OUTPUT;
pressEnter();
}
sub pressEnter
{
print "Press Return to continue\n\n";
$dummy = <>;
mainMenu();
}
I've included another sub function so you can see how it is called.
RE: PERL - pressEnter function hanging
CODE
RE: PERL - pressEnter function hanging
RE: PERL - pressEnter function hanging
Probably the easiest way to fix this, based on the code you posted, is something like the following:
CODE
`./scriptlist.ksh 2`;
open OUTPUT, "./output";
#undef $/;
{
local $/ = undef;
$_ = <OUTPUT>;
}
RE: PERL - pressEnter function hanging
Thanks.
RE: PERL - pressEnter function hanging
Good catch, rharsh.
Feherke.