in reply to file parsing help
if ($index eq '' )
should be
if (trim($index) eq '' )
Also, something's fishy about
if ($id eq "") { $id=sprintf("%-*s",8,$prev_id); } else { $id=sprintf("%-*s",8,$prev_id); }
By the way, please use <c>...</c> instead of <pre>...</pre> on PerlMonks.
Update:
$a=index($sub_line,'|',1); $b=index($sub_line,'|',8); $c=index($sub_line,'|',20);
should be
$a=index($sub_line,'|'); $b=index($sub_line,'|', $a+1); $c=index($sub_line,'|', $b+1);
Although you shouldn't use $a and $b. They are special variables, and using them can create problems at a distance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: file parsing help
by ctaustin (Sexton) on Nov 13, 2006 at 17:32 UTC | |
by ikegami (Patriarch) on Nov 13, 2006 at 17:35 UTC |