On Friday 21 December 2007 11:01, banker123 wrote: > Some mild progress here is what I have so far. Couple of questions: > > 1. This only processes the first record in the file, the file has > many records and I would like to process each record. > 2. My array has empty elements, how do I remove empty or blank > elements? > 3. When I print the array the first element is on row 1 and the > remaining elements are on row 2, how do I print on 1 row? > > open INPUT, "c:/organization.txt" or die "Can't open file: $!"; > open OUTPUT, ">c:/out.txt" or die "Can't open file: $!"; > > $data=<INPUT>; > @array=split(',',$data); > @[EMAIL PROTECTED],-2,-3,-4,-5,-6,-7]; > print OUTPUT "@slicedata";
Or simply: my @slicedata = ( reverse split /,/, <INPUT> )[ 0 .. 6 ]; print OUTPUT "@slicedata"; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/