saintmike2
Programmer
I have a script that calls a subroutine called "main" that it just basically a just continuous loop that never terminates.
The porblem is that given the struct of the code below, it will read the first line in the file handle run "main" and then stay in main forever without returning back to the original "while (<FH>)" loop. Does anyone know exactly what can be done so that I can just execute "main" but not wait for it's completion?
BEGIN CODE SNIPPET:
while (<FH>)
{
if ($_ =~ /Value0/)
{
$IPAddy = $';
$IPAddy = /\d+\.\d+\.\d+\.\d*/;
$IPAddy = $&;
$Ident = "Value0";
&main($IPAddy);
sleep(5);
}
if ($_ =~ /Value1/)
{
$IPAddy = $';
$IPAddy = /\d+\.\d+\.\d+\.\d*/;
$IPAddy = $&;
$Ident = "Value1";
&main($IPAddy);
sleep(5);
}
if ($_ =~ /Value2/)
{
$IPAddy = $';
$IPAddy = /\d+\.\d+\.\d+\.\d*/;
$Ident = "Value2";
$IPAddy = $&;
&main($IPAddy);
sleep(5);
}
}
/END CODE SNIPPET
Any Ideas?
Mike
The porblem is that given the struct of the code below, it will read the first line in the file handle run "main" and then stay in main forever without returning back to the original "while (<FH>)" loop. Does anyone know exactly what can be done so that I can just execute "main" but not wait for it's completion?
BEGIN CODE SNIPPET:
while (<FH>)
{
if ($_ =~ /Value0/)
{
$IPAddy = $';
$IPAddy = /\d+\.\d+\.\d+\.\d*/;
$IPAddy = $&;
$Ident = "Value0";
&main($IPAddy);
sleep(5);
}
if ($_ =~ /Value1/)
{
$IPAddy = $';
$IPAddy = /\d+\.\d+\.\d+\.\d*/;
$IPAddy = $&;
$Ident = "Value1";
&main($IPAddy);
sleep(5);
}
if ($_ =~ /Value2/)
{
$IPAddy = $';
$IPAddy = /\d+\.\d+\.\d+\.\d*/;
$Ident = "Value2";
$IPAddy = $&;
&main($IPAddy);
sleep(5);
}
}
/END CODE SNIPPET
Any Ideas?
Mike