You're asking to split input data on newlines, but you are reading the data a line at a time. So, your split (at
foreach (split(/\n/,$data)) {)is "splitting" the $data into two pieces: everything before the newline and everything after. Since the newline is at the end of the line (by definition....), there's not much in the second chunk.Now, when splitting the chunks of $data, it will split them into a chunk ($fldname, with everything before the first colon(":"), and $fldvalue will contain everything after the first colon.
So, the split on newline is superfluous, unless you reset $/ (see perlvar).
emc
At that time [1909] the chief engineer was almost always the chief test pilot as well. That had the fortunate result of eliminating poor engineering early in aviation.
—Igor Sikorsky, reported in AOPA Pilot magazine February 2003.In reply to Re^3: how to split based on new line or others ?
by swampyankee
in thread how to split based on new line or others ?
by bh_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |