I am just wondering...what am I doing wrong here. Why isn't "$latest_CPU_load\n" printing the desired value like $top_output[2]....
Any help here?
Thanks,
Arijit
vgamd127> cat test.pl
#!/depot/qsc/VG1.0/bin/perl
#!/depot/qsc/VG1.0/bin/perl
@top_output = `top -n1 -b -i | head -35`;
print "$top_output[2]";
$latest_CPU_load = grep(/load average/, @top_output);
print "$latest_CPU_load\n";
vgamd127> ./test.pl
06:01:29 up 135 days, 20:56, 36 users, load average: 1.02, 1.03, 1.08
1
vgamd127> ./test.pl | od -bc -
0000000 040 060 066 072 060 061 072 061 063 040 040 165 160 040 061 063
0 6 : 0 1 : 1 3 u p 1 3
0000020 065 040 144 141 171 163 054 040 062 060 072 065 066 054 040 063
5 d a y s , 2 0 : 5 6 , 3
0000040 066 040 165 163 145 162 163 054 040 040 154 157 141 144 040 141
6 u s e r s , l o a d a
0000060 166 145 162 141 147 145 072 040 061 056 060 063 054 040 061 056
v e r a g e : 1 . 0 3 , 1 .
0000100 060 063 054 040 061 056 060 070 012 061 012
0 3 , 1 . 0 8 \n 1 \n
0000113
print "$top_output[2]";
$latest_CPU_load = grep(/load average/, @top_output);
print "$latest_CPU_load\n";
vgamd127> ./test.pl
06:01:29 up 135 days, 20:56, 36 users, load average: 1.02, 1.03, 1.08
1
vgamd127> ./test.pl | od -bc -
0000000 040 060 066 072 060 061 072 061 063 040 040 165 160 040 061 063
0 6 : 0 1 : 1 3 u p 1 3
0000020 065 040 144 141 171 163 054 040 062 060 072 065 066 054 040 063
5 d a y s , 2 0 : 5 6 , 3
0000040 066 040 165 163 145 162 163 054 040 040 154 157 141 144 040 141
6 u s e r s , l o a d a
0000060 166 145 162 141 147 145 072 040 061 056 060 063 054 040 061 056
v e r a g e : 1 . 0 3 , 1 .
0000100 060 063 054 040 061 056 060 070 012 061 012
0 3 , 1 . 0 8 \n 1 \n
0000113
vgamd127>
Yahoo! Mail
Bring photos to life! New PhotoMail makes sharing a breeze.
_______________________________________________ Perl-Unix-Users mailing list Perl-Unix-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs