which contains:@ServicesOnMachine = `/sbin/chkconfig --list | awk '{print \$1}'`;
My 2nd array is:NetworkManager acpid anacron atd auditd autofs avahi-daemon avahi-dnsconfd bluetooth capi conman cpuspeed crond cups dnsmasq dund firstboot gpm haldaemon hidd hplip httpd ip6tables iptables irda irqbalance iscsi iscsid isdn kudzu lvm2-monitor mcstrans mdmonitor mdmpd messagebus multipathd netconsole netfs netplugd network nfs nfslock nscd ntpd oddjobd pand pcscd portmap psacct rawdevices rdisc readahead_early readahead_later restorecond rpcgssd rpcidmapd rpcsvcgssd saslauthd sendmail smartd sshd svnserve syslog tcsd vboxadd vboxadd-service vboxadd-x11 vncserver wdaemon winbind wpa_supplicant xfs ypbind yum-updatesd
I want to make it so if any values from the 1st and 2nd array match up, it will print the output... Probably something like....?@ServiceCheckList = ("spray", "echo", "daytime", "discard", "chargen", + "ttdb", "ypbind", "ypserv", "yppasswdd", "ypxfrd", "tooltalk", "rsta +td", "comsat", "talk", "uucp", "finger", "netstat", "systat", "rusers +", "walld", "rexd", "rje", "netbios", "lpd", "http", "gopher", "tcpmu +x", "news", "nntp", "snmp", "mail", "smtp", "pop2", "pop3", "sendmail +", "httpd");
Obviously this isn't it but I need something to print only matching values. Thanks in advance! :)foreach (@ServiceCheckList eq @ServicesOnMachine) { print $_; }
In reply to Comparing two arrays... by austin43
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |