I am parsing a series of lines and sometimes the segment is not there, but I have to return a single space for the position.
My current code is
# segin[6] is N3 - Bill to Address
@line = split(/\^/, $segin[6]);
$bt_add1 = substr($line[1], 0, 31);
$bt_add2 = substr($line[2], 0, 31);
Here is a sample of the data.
~N3^1514 JEFFERSON HWY~N4
For this example there is no $line[2], there are other cases where there is no segin[6] so I want to default a space.
Is this possible?
My current code is
# segin[6] is N3 - Bill to Address
@line = split(/\^/, $segin[6]);
$bt_add1 = substr($line[1], 0, 31);
$bt_add2 = substr($line[2], 0, 31);
Here is a sample of the data.
~N3^1514 JEFFERSON HWY~N4
For this example there is no $line[2], there are other cases where there is no segin[6] so I want to default a space.
Is this possible?