• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Need help with perl

shikhan

Senior member
Hi guys,
I need some help on how to code something. I've got a script that does the following (in perl)

$continue = 1;
while ($continue) {
&dowork;
&sleep(600);
}

What I want is a clean way for the user to quit this program. If the user doesn't type anything, or presses keys other than, say, 'q', for the program to continue looping. I apparently can't use threads because when I tried, the script broke and said that this version of perl wasn't compiled for threads.

Any suggestions?
 
do while($_<>'q')
{ your stuff}


or

unless($_ = 'q')
do {whatever your stuff is}

The $_ should be the standard IO unless you've changed it

There are other ways & abbreviations ...

Good Luck

Scott
 
Originally posted by: ScottMac
do while($_<>'q')
{ your stuff}


or

unless($_ = 'q')
do {whatever your stuff is}

The $_ should be the standard IO unless you've changed it

There are other ways & abbreviations ...

Good Luck

Scott

My &dowork subroutine does file parsing in which I use $_. But it is all inside the sub. Is it still okay to use what you said?

Plus, I'm getting a compile error when I try while($_<>'q')
 
Back
Top