I am using this input data,
BIG^20090807^45315897^20090807^1550510^^^DI
This is the code,
# segin[3] is BIG
for ($seqin[3]) {
@line = split(/\^/, $segin[3]);
$company = substr($line[4], 0, 1);
if($company eq 1) {
$company = 120;
} elsif($company eq 7) {
$company = 710;
} elsif($company eq 8) {
$company = 800;
}
$invoice_dte = $line[1];
$invoice = $line[2];
$po_date = $line[3];
$po_number = $line[4];
$x = $line[5];
$y = $line[6];
if ($line[7]) {
$inv_typ = " ";
}else {
$inv_typ = $line[7];
}
}
The last segment ($LINE[7]) is never found and neither are segments 5 or 6.
Perl seems to get confussed when there are several seperators with no data.
Does anybody know of a fix for this?
BIG^20090807^45315897^20090807^1550510^^^DI
This is the code,
# segin[3] is BIG
for ($seqin[3]) {
@line = split(/\^/, $segin[3]);
$company = substr($line[4], 0, 1);
if($company eq 1) {
$company = 120;
} elsif($company eq 7) {
$company = 710;
} elsif($company eq 8) {
$company = 800;
}
$invoice_dte = $line[1];
$invoice = $line[2];
$po_date = $line[3];
$po_number = $line[4];
$x = $line[5];
$y = $line[6];
if ($line[7]) {
$inv_typ = " ";
}else {
$inv_typ = $line[7];
}
}
The last segment ($LINE[7]) is never found and neither are segments 5 or 6.
Perl seems to get confussed when there are several seperators with no data.
Does anybody know of a fix for this?