#/bin/perl/ use strict; my @files; @files = `ls 2kc29-out.txt`; my $file = $_; $_= $file; my $start = 0; open my $input, '<', './2kc29-out.txt' or die $!; open my $output, '>', 'test_mon.txt' or die $!; while (<$input>) { s/^\s+//; next unless (($start) || (/^0.00000/)); $start = 1; my @columns = split /\s+/, $_; printf $output ("%8.3f%10.3f","$columns[2] $columns[3]"); #here I'm testing how columns 3 and 4 print #print $output (@columns[2..10]); #here I'm trying to see how to write "print from column 3 until the end - pretending that 10 is the end just as a test #printf $output ("%8.3f%10.3f",(@columns[2..10])); #same as above, but trying to see how to use printf, obviously this only prints columns 3 and 4 and nothing else printf $output "\n"; }