[EMAIL PROTECTED] wrote: > > All, Hello,
> was hoping anyone could provide some syntax help. > > I want to populate an array from a system app call like so.... and then > print out each element. > > my @ftapes = system ("evmvol -w label_state=3|grep barcode"); > print $ftapes[0] > > or > > print $ftapes[0,1] > > The problem is it prints out all the lines for print $ftapes[0] and does > not print for print $ftapes[0,1] > > OR > should I just run the system call, put it to a file > then open the file, read line by line > chomp > foreach $_ > print $_ > close file Either: my @ftapes = grep /barcode/, `evmvol -w label_state=3`; Or: open PIPE, 'evmvol -w label_state=3 |' or die "Cannot open pipe from evmvol: $!"; my @ftapes = grep /barcode/, <PIPE>; close OUTPUT or warn $! ? "Cannot close pipe from evmvol: $!" : "Exit status $? from evmvol"; print $ftapes[ 0 ]; or print @ftapes[ 0, 1 ]; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>