
perlwatcher
User
Jul 19, 2010, 1:09 AM
Post #1 of 3
(533 views)
|
|
array length gets printed instead of array Perl
|
Can't Post
|
|
I was trying to kill a process from the output of the ps -aef | grep <processname> The following is the output from the command which is assigned to variable $result my $result = '[root@genstor ~]# ps -aef | grep radiusd root 30543 1 0 Jul18 ? 00:00:00 radiusd -d /usr/local/etc/raddb/ root 30554 1 0 Jul18 ? 00:00:00 radiusd -d /usr/local/etc/raddb_2/ root 31059 30986 0 00:06 pts/2 00:00:00 [root@genstor ~]# '; I was trying to kill the process with id 30554 which is under /usr/local/etc/raddb_2/ When I write a small individual script and try to fetch the PID ( 30554) it works well and good, but when I use the same in my framework in both the ways I am trying to split the $result variable using split function like follows my @arr = split /\s+/,$result; When I print @arr while using the framework I am seeing the value as 5 ( which I believe is the size of the array given the no of new lines ) Can anyone help me in this ?
|