Hello all,
I have a text file I need to split up into scalars. The format of the text file is:
what I need is to break each line into scalars and if there is any Exceptions, break them into scalars, if not do something else.
Something like
My problem is there could be any number of exceptions or no exceptions for each company, and I need to assign each exception to a different scalar.
I have some flexability over the format of the file I am processing.
Thanks for any help,
Nick
I have a text file I need to split up into scalars. The format of the text file is:
Code:
Company Key Company Name Exceptions
abc, ABC Company,
def, DEF Company, HIJ KLM
nop, NOP Company, QRS
what I need is to break each line into scalars and if there is any Exceptions, break them into scalars, if not do something else.
Something like
Code:
while <FILE>
chomp;
next if /^Company Key/;
if (/\w{2,3},\s+\w+\s+,\w+/) {
($key,$company,$exception1,$exception2,etc.) = split (/,/);
}else{
($key,$company) = split (/,/);
}
My problem is there could be any number of exceptions or no exceptions for each company, and I need to assign each exception to a different scalar.
I have some flexability over the format of the file I am processing.
Thanks for any help,
Nick