And change Search_Buff() to so:if (&Search_Buff($decide == "1")){ &Site_Up; } else { &Site_Down; } To: if( &Search_Buff ) { &Site_Up; } else { &Site_Down; }
sub Search_Buff { open (gethttpbuff, "gethttpbuff.txt") || die("Could not open file! +"); @array = <gethttpbuff>; close(gethttpbuff) foreach $line (@array) { if ($line =~ /$search/) { return 1; } } return 0; }
That should make everything work just fine.
There are a number of other items you can do, such as adding use strict; to the top of your script to make it more robust, but that should get you going for now.
Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.
In reply to Re: Problem Searching an array for a string... Please Help!
by dragonchild
in thread Problem Searching an array for a string... Please Help!
by XehNib
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |