in reply to Re^4: divide multi-column input file into sub-files depending on specific column's value
in thread divide multi-column input file into sub-files depending on specific column's value
I can't see anything wrong with your printf statement, and it works for me:
open $FORM, '>', 'column.FORM' or die $!;; @c = (1.2, 1.3, 1.4, 1.5); $t = '%10s'x@c . "\n"; printf( $FORM $t, @c );; close $FORM;; ^C C:\test>type column.FORM 1.2 1.3 1.4 1.5
so what is going wrong I have no idea.
Equally your comment, #chomp; # this gives me syntax errors??? makes no sense, chomp; cannot be a syntax error.
Your comments in an earlier thread to the effect of "I don't know why it didn't work before but it does now", all suggest that the way you are writing your code; or running your scripts, or some other environmental factor is causing you to experience problems that are not down to Perl, or the code you are posting.
The upshot is, I'm going to suggest that you try to seek out someone local to you with some programming knowledge to watch you write and run a small, simple program and perhaps he will see the problem that we cannot see when interacting with you this way.
A final comment on your script above: You do know that:$columns[$#columns] is a single value?
If so, why are you using a foreach loop to iterate over a single value?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: divide multi-column input file into sub-files depending on specific column's value
by angela2 (Sexton) on Jul 05, 2016 at 16:23 UTC | |
by Anonymous Monk on Jul 05, 2016 at 16:39 UTC |