in reply to split function
$a,$b,$1,$2 etc are special variables that Perl uses.while (<$fh_in>) { chomp; #deletes the trailing "new line" line ending #this works for files from any OS my @array = split(';',$_); }
Is there a limit of length that split function can handle, otherwise, it will truncate the line into next line. is there a way how to resolve it?while (<$fh_in>) { print; #prints $_ (the line from $fh_in) my ($first_thing) = split(';',$_); print "$first_thing\n"; }
There is no "hard limit" on the length of the expression that split can handle nor is there a limit on the size of the resulting array. ...well ok.. there is a limit somewhere, but this limit is certainly not 36 ... it is in the range of many thousands or even more... In a practical sense: NO. There is no limit, meaning that the limit is so huge that you won't encounter it in normal programming.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: split function
by tcheungcm (Novice) on Jan 25, 2012 at 08:20 UTC | |
by Marshall (Canon) on Jan 25, 2012 at 08:34 UTC | |
by Anonymous Monk on Jan 25, 2012 at 08:37 UTC | |
by rovf (Priest) on Jan 25, 2012 at 11:22 UTC | |
by tcheungcm (Novice) on Jan 26, 2012 at 08:20 UTC | |
by rovf (Priest) on Jan 26, 2012 at 09:21 UTC | |
by Anonymous Monk on Jan 26, 2012 at 08:31 UTC | |
by tcheungcm (Novice) on Jan 26, 2012 at 08:41 UTC | |
|