On Jul 10, 5:59 am, [EMAIL PROTECTED] (Anirban Adhikary) wrote: > Dear list > I want to capture the output of w and then I want to do some job as per the > o/p of w command in my linux system. So i have written the code as follows > > use strict; > use warnings; > > open (LS, "w|") or die "can't open w: $!";
Success for pipes should be checked when you close them. > my @arr = <LS>; > close (LS); > shift @arr; > shift @arr; > my($one,$two,$three,$four,$five,$six,$seven,$eight); > > foreach my $el(@arr) > { > ($one,$two,$three,$four,$five,$six,$seven,$eight) = split(/ /,$el); Change that to split " ". When you split / / you get fields in between each space. -- Brad -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/