Dear List
I am facing the following problem.While running the below mentioned code
open(WHO, "who|")or die "can't open who: $!";
@arr = <WHO>;
close(WHO);
print $arr[2]."\n";
I am getting this output --- root tty3 2008-02-24 12:58 . But
when i am trying to extract the 3 rd filed by using
$a = $arr[2]
@arr2 = split(/ /, $a);
print $arr2[2]."\n";
I am not getting any output . Please guide me
Another case when running the same code for ls -l/
open (LS, "ls -l|") or die "can't open ls -l: $!";
@arr = <LS>;
close (LS);
foreach(@arr)
{
@arr1 = split(/ /,$_);
}
foreach $perm (@arr1)
{print "$perm\n"; }
I am getting the last entry from ls -l listing. How can I get the entire
listing of ls -l command's output in an array??
Thanks & Regards In advance
Anirban Adhikary.