One way to create a function with a hole is multiplying and dividing it by x, like this:
$f(x) = 1$
$g(x) = \frac{x}{x}$
This creates a so-called "removable singularity" at $x=0$. At school I was taught not to remove such singularities, so I wonder if holes are ever real, or are they just a mathematical artefact that has nothing to do with reality?
Other types of singularities make perfect sense (for example in the trigonometric function $tan$), but they don't create holes. I'm not familiar with any situation where a hole in the function makes sense.
A function can be described as a set $F$ of ordered pairs with the property that if $(x,y)\in F$ and $(x,z)\in F$, then $y=z$. The idea is that it is the collection of $\{(x,f(x)\mid x\in D\}$ where $D$ is the domain of the function.
A "hole" in a real input, real-valued function (a subset of $\mathbb R\times \mathbb R$) amounts to the absence of a particular ordered pair.
For example:
$F_1=\{(x,\frac{x}{x})\mid x\in \mathbb R, x\neq 0\}$
$F_2=\{(x,1)\mid x\in \mathbb R\}$
are almost, but not quite, the exact same function. The difference is that $F_2$ has one more point: $(0,1)$, whereas $F_1$ has a hole there.