Let $f : E \rightarrow \mathbb{R}$. Show that if $|f|$ is measurable on $E$ and the set $\{f > 0\}$ is measurable, then $f$ is measurable on $E$. I'm learning about Measure Theory (specifically measurable functions) and need help with the following problem:

Let $f : E \rightarrow \mathbb{R}$. Show that if $|f|$ is measurable on $E$ and the set $\{f > 0\}$ is measurable, then $f$ is measurable on $E$.


What I don't understand is that the implication $$|f| \ \text{measurable}  \implies f \ \text{measurable} \ \ (1)$$ is clearly false. 
For example, let $A$ be a non-measurable subset of $\mathbb{R}$, and let $f$ be the function $$f(x) = \begin{cases} 1\text{ if }x\in A,\\ -1\text{ if }x\notin A.\end{cases}$$
Then $f$ is not measurable ($f^{-1}[\{1\}] = A$) but $|f|$ is measurable (it's the constant function $1$). 

How does the additional condition that $\{f > 0\}$ is measurable makes the implication $(1)$ true and how do I prove it? 

You have that
if $b \geq 0, f^{-1}(]b,a[) = (|f|)^{-1}(]b,a[) \cap \{f > 0 \}$, so it's measurable
if $b < 0, f^{-1}(]b,0]) = (|f|)^{-1}([0,-b[ ) \cap \{f > 0 \}^c$, so it's also measurable
This imply that if $a>0, b<0$,  $f^{-1}(]b,a[) = f^{-1}(]0,a[) \cup f^{-1}(]b,0])$ is measurable
if $a < 0, b<a, f^{-1}(]b,a[) = (|f|)^{-1}(]-a,-b[) \cap \{f > 0 \}^c$, so it's also measurable
hence $f^{-1}(]b,a[)$ is measurable for all $a>b$
