So the other answers are very good, but I'd like to put it to a practical scenario. Suppose you are testifying against Bob (you are a witness for the prosecution) who is being tried for the murder of Alice. You testify you saw Bob kill Alice and run away. You could identify it was Bob because you and Bob are coworks. You see him every day, and you don't talk to him often, but you recognize him anywhere.
Then the defense comes from Cross-Examination and asks "Are you aware that Bob has an Identical Twin Brother, Charlie?" So here is a situation you discussed: You testified to something that many not be factually true. You identified Bob as the murder, but the possibility exists that Charlie killed Alice. (At this point, we haven't proven Bob did not kill Alice, or the Charlie did. All we did was raise a doubt that Bob killed Alice showing that Charlie could have done it.).
If you were unaware, this is not perjury, the defense is just trying to impeach you as a witness (has nothing to do with your political office... Impeaching is basically showing the jury that there are reasonable doubts to your claim). To the best of your knowledge Bob was not an identical twin... thus, seeing Charlie would logically cause you to believe it was Bob.
If you were aware of this, this still doesn't mean you perjured yourself. After all, anyone who has ever met a set of twins can tell you that they aren't 100% identical. Bob could have a scar that Charlie does not, thus you could say you saw the scar. Charlie could live on the other side of the country and you weren't aware he was in town that night. Perhaps it was late night at the office and Bob has the key but Charlie, who doesn't work there, wouldn't have the key.
If you were aware that Bob had a twin, it could be when you called the police, you told them it was either Bob or Charlie and through detective work, the police arrested Bob, and not Charlie. Here, in your testimony, you probably should have said you told the cops that it was one of the twins, but the fact is they relied on your reporting to make a case against one twin, the one here. You would know that the case is against Bob by the name of the case (People vs. Bob) or reporting in the news. Here the prosecutor is more at fault than you because he should have coached you to say "one of the twins" and not Bob and avoid this, but as a lay person who wouldn't know that much, this is probably not intentionally lying. Likely the Prosecutor who gets into this situation during a Re-Direct by asking you if you knew at the time you talked to the police if Bob committed the crime and/or Are you only referring to Bob in testimony because he is on trial? (The first verifies that your testimony was identifying the pair and the reasonable explanation for referring to bob in testimony when you didn't know at the time.).
In order for this to be perjury, you would have A) know that Bob had an identical twin brother Charlie AND B) knew that Charlie killed Alice, but testified that it was Bob OR C) identified Bob and only Bob because you don't like Bob for some reason.
If we break this down, into a truth table of sorts, where 1 is true and 0 is false, then the following proposition for perjury is as follows:
A && (B || C) = 1
This means that A MUST ALWAYS BE 1. It's possible for A = 0, B = 0 and C = 1, but that means that 0 && (0 || 1) = 0 && 1 = 0. Since 0 is false, you didn't perjure yourself It's impossible for A = 0, B = 1 and C = 0 which becomes 0 && (1 || 0) = 0 && 1 = 0. This is logically false in proposition and down right impossible by the proportions. You cannot simultaneously not know Bob had a twin and know that it was Bob's twin brother who committed the crime.
If you knew Bob had a twin and identified both twins to the investigators but testified about Bob being the killer, then the question is A = 1, B = 0, and C = 0. Which will result in the final metric being 1 && 0 which will equal 0.
Only a situation where A = 1 and either B or C or both equal 1 in order for this to be perjury.
Edit:
With respect to comments, of uncertainty of B or C testimony, this is why you will often here witnesses say something to the effect of "to the best of my recollection/knowledge" or "The event occurred on or around [a date]"
these statements are used as basic excuses to say "I'm not fully sure about the answer, but I'm giving you the best one I have". For example, the answer to the question "When was the U.S. Declaration of Independence signed?" answering "July 5th, 1776" is wrong and perjury. However, if I didn't have the best knowledge of the subject and said "On or around July 5th, 1776", I haven't told the truth, but more importantly, I haven't lied. The document was really signed on July 4th, 1776, so it was in fact signed "On or around July 5th, 1776".
In order to be false you must prove that A) It was not signed on July 5th, 1776 OR B) it was signed on a date that is reasonably close to the date of July 5th, 1776.
So this means that A = 0 (it's false) and B = 1 (True). Our equation to prove this is false would be:
A || B = 0
Since this is an or Statement, only one statement needs to be true for the entire statement to be true. Since B is factually correct, it doesn't matter that A is false, the entirety of my statement is True.
Now, I haven't discussed another component of perjury, you also have to demonstrate that the false testimony is malicious in nature. In our original scenario, Bob's defense says Bob secretly recorded himself telling the witness about his twin brother prior to the crime occurring. When his lawyer asks if Bob ever told you he has a twin, and you answer No, then the Defense can present the evidence that you are wrong, opening yourself up to perjury. However, if the answer is "Not that I recall", the statment is not perjury.
Basically, here to prove perjury, you have to prove A) You had a conversation with Bob about his twin brother AND B) you did recall it.
Since we have hard evidence that A = 1, the question hinges on B. That's harder to proven because. You could have remembered it and lied (B = 1) or you could have not been paying attention and never really registered the conversation mentioned a twin brother (B = 0). Either way, the truthiness of B cannot be reliably discerned. No lawyer on planet earth can read minds (in so far as I am aware). And since perjury is a crime you are accused of, the lawyer needs to prove you knowlingly lied. In absence of proof that you do recall this specific conversation, you are assumed innocent and thus B = 0.
For this statement, guilty would be such that
A && B = 1
AND statements, in logic are different from OR statements. In order for the statment to be true, Both A and B must be 1. If either one is 0, then the statement on a whole is 0.
Thus A = 1 and B = 0, then 1 && 0 = 0.