My issue is that as soon as an "empty" field comes up (two commas in a row), split seems to think the line is done and goes to the next one.
Everything I've read online says that split will return a null field, but I don't know how to get it to go to the next element and not just skip to the next line.
Expand|Select|Wrap|Line Numbers
- while (<INFILE>) {
- # use 'split' to avoid module-dependent functionality
- # split line on commas, OS info in [3] (4th group, but
- # counting starts first element at 0)
- # line = <textonly>,<text+num>,<ip>,<whatIwant>,
- chomp($_);
- @a_splitLine = split (/,/, $_);
- # move OS info out of string to avoid accidentally
- # parsing over stuff
- $s_info = $a_splitLine[3];
I was thinking I could run a simple substitution before parsing of a known string (something ridiculous that'll never show up in my data - like &^%$#), then split, and then when printing, if that matches the current item, just print some sort of whitespace, but that doesn't sound like the best method to me - like I'm overcomplicating it.