#!/usr/bin/perl use warnings; use strict; my %fhs; # hash with last_column values open my $INPUT, '<', 'input_file' or die $!; while (my $line = <$INPUT>) { #chomp; # this gives me syntax errors??? my @columns = $line =~ m/\s*(-?[.\d]+)/g; # split columns foreach ($columns[$#columns]) { # foreach element of the last column = cluster ID open my $FORM, '>', 'output.FORM' or die $!; my $columnform = "%10s"x(@columns) . "\n"; # printf ($FORM $columnform, @columns); # hangs, creates empty file printf $columnform, @columns; # prints on screen correctly close $FORM; } } #### #!/usr/bin/perl use warnings; use strict; my %fhs; # hash with last_column values open my $INPUT, '<', 'input_file' or die $!; while (my $line = <$INPUT>) { #chomp; # this gives me syntax errors??? my @columns = $line =~ m/\s*(-?[.\d]+)/g; # split columns open my $FORM, '>', 'output.FORM' or die $!; my $columnform = "%10s"x(@columns) . "\n"; # printf ($FORM $columnform, @columns); # hangs, creates empty file printf $columnform, @columns; # prints on screen correctly close $FORM; foreach ($columns[$#columns]) { # foreach element of the last column = cluster ID # blah } }