Re: Executing a unix command using file-handle

2008-02-24 Thread John W. Krahn
Anirban Adhikary wrote: Dear List Hello, I am facing the following problem.While running the below mentioned code You should have these two lines at the beginning of your Perl program: use warnings; use strict; open(WHO, "who|")or die "can't open who: $!"; @arr = ; close(WHO); print $ar

Re: Executing a unix command using file-handle

2008-02-24 Thread Jeff Pang
What you need is maybe this: use strict; use Data::Dumper; open(WHO, "who|")or die "can't open who: $!"; my @arr = ; close(WHO); print Dumper [EMAIL PROTECTED]; for (@arr) { print STDOUT (split)[2],"\n"; } open (LS, "ls -l|") or die "can't open ls -l: $!"; @arr = ; close (LS); shift @arr