I noticed that sometimes ctrl-L selects all and sometimes A works instead. What is the difference between the two?
In edit mode Ctrl+L selects all geometry that is linked to the geometry you have selected. So if you have a mesh with two (or more) 'loose parts', and you select one face of one of those partes, hitting ctrl+L will select all the faces in that part, but not the other one(s). While A will select every face in the mesh regardless of being in another part.
That's why Ctrl+L doesn't do anything unless you already have something selected.
A selects all geometry. ctrlL selects linked geometry. In edit mode, if you have geometry selected, it would let you select all of the geometry connected. Here is a quote from docs.blender.org:
Select geometry connected to already selected elements. This is often useful when a mesh has disconnected, overlapping parts, where isolating it any other way would be tedious.