#!/usr/bin/perl -w @success = qw(client1 client2 client3 client9); print "the success array is @success\n"; @arr = qw(client3 client9); $asize = scalar(@arr); $absize = scalar(@success); @using = qw(client2); print "\n @using \n"; $usize = @using; print "\n $asize $absize \n"; for ( $i = 0 ; $i < $asize ; $i++ ) { for ( $j = 0 ; $j < $absize ; $j++ ) { if ( $arr[$i] eq $success[$j] ) { print " \n $i $j "; print " before $arr[$i] our choice\n"; check( $arr[$i] ); print "after check our choice \n"; } } } ###end of t sub check { print "################ checking client status $_[0] ###################### "; print "inside function call \n\n\n"; our $sc = $_[0]; for ( $j = 0 ; $j < $usize ; $j++ ) { if ( $sc eq $using[$j] ) { print "$sc is in use pls dont use \n"; ###should we move to some file"; } else { if ( $j eq $usize - 1 ) { print " reboot client\n"; print "before reboot\n"; } } } } hi
i am trying to check whether the content of "arr" array is in "success" array if its true i am checking whether that element is present in "using" array . but here it is going for infinite loop if the input client is client3 and client9 in "arr" array ..
thank you in advance
use strict;anduse warnings;