http://www.perlmonks.org?node_id=950045


in reply to Re^6: split function
in thread split function

The datafile

1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;27;28;29;30;31;32;33;34;35;36

1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;27;28;29;30;31;32;33;34;35;36

1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;27;28;29;30;31;32;33;34;35;36

1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;27;28;29;30;31;32;33;34;35;36

sub split_the_element{ my ($local_fh) = @_; while (<$local_fh>) { chomp; my $size = length $_; print "size $size\n"; foreach my $element (split ';', $_) { printf $fhout "%s,\n", $element; } }
However, the line get chop after the lengh is >= 51. Is there any workaround which can read the full line?

size 51

size 51

size 51

size 51

size 51

size 51

size 51

size 51

size 51

size 36