  We establish asymptotic formulae for the first and second moments of
quadratic Dirichlet $L$--functions, at the centre of the critical strip,
associated to the real quadratic function field $k(\sqrt{P})$ and inert
imaginary quadratic function field $k(\sqrt{\gamma P})$ with $P$ being a monic
irreducible polynomial over a fixed finite field $\mathbb{F}_{q}$ of odd
cardinality $q$ and $\gamma$ a generator of $\mathbb{F}_{q}^{\times}$. We also
study mean values for the class number and for the cardinality of the second
$K$-group of maximal order of the associated fields for ramified imaginary,
real, and inert imaginary quadratic function fields over $\mathbb{F}_{q}$.
  One of the main novelties of this paper is that we compute the second moment
of quadratic Dirichlet $L$-functions associated to monic irreducible
polynomials. It is worth noting that the similar second moment over number
fields is unknown.
  The second innovation of this paper comes from the fact that, if the
cardinality of the ground field is even then the task of average $L$-functions
in function fields is much harder and, in this paper, we are able to handle
this strenuous case and establish several mean values results of $L$-functions
over function fields.
