in reply to Re: Spliting Table (a solution)
in thread Spliting Table

Thank you for your help. Your described solution is actually not my real problem as I do know, how it should look like, but I want to let the script run automatically through the whole Input.file, as there are over 100people and I do not want to give every file a name myself. My main problem is the part where it automatically counts which column to take for the next file/person:
1st file: column 1-4 and 5-13;
2nd file: column 1-4 and 14-22;
3rd file: column 1-4 and 23-31;
4th file: ...
to give every new file a name will be the next problem.. =)

Replies are listed 'Best First'.
Re^3: Spliting Table (a solution)
by Anonymous Monk on Aug 20, 2015 at 08:50 UTC

    my main problem is the part where it automatically counts which column to take for the next file/person:

    Think about it, how would you as a person do the counting?

    Now write down the description and post it here.

Re^3: Spliting Table (a solution)
by Anonymous Monk on Aug 20, 2015 at 09:27 UTC

    Over and out

    #!/usr/bin/perl -- ## tinking.pl ## 2015-08-20-02:28:04 ## ## ## ## ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if while for " +-otr -opr -ce -nibc -i=4 -pt=0 "-nsak=*" ## perltidy -olq -csc -csci=3 -cscl="sub : BEGIN END " -otr -opr -ce +-nibc -i=4 -pt=0 "-nsak=*" #!/usr/bin/perl -- use strict; use warnings; use autodie qw/ open close /; use Data::Dump qw/ dd /; my $infile = \q{ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz bcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyza cdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzab }; Roger( $infile ); exit( 0 ); sub Roger { my( $infile ) = @_; open my( $infh ), '<', $infile; ## "or die..." by autodie my $count = 5; while( <$infh> ) { next if !/\S/; my @what = split //, $_; #~ dd( \@what ); my $right = $count + 8; @what = grep defined, @what[ 0 .. 4, $count .. $right ]; #~ dd( \@what ); Dodger( \@what ); $count = $right; } ## end while( <$infh> ) } ## end sub Roger sub Dodger { my( $arref ) = @_; print join ',', @$arref, "\n"; } ## end sub Dodger