Its ok, nothing special. I've lived on every line. In order of safety I feel they are from most safe to least safe...
Joondalaup mandurah (not great but always has guards and a lot of stops just go to new communities armadale (used to be bad but now a lot of people use it so safety has come up) fremantle (so so many drunks and 'locals' going to fremantle - perth to beg and busk and club) midland (always the worst)
that being said I've never been robbed once and I've used the train a LOT. 10000+ trips... I've seen people robbed on the midland, armadale and freo lines in 20 years of use.
Yes - I have lived on the Fremantle line for a number of years (near the West Leederville station and now City West) and do quite a bit of train travel, including late at night visiting friends in Fremantle (mostly on weekends). I feel safer on the Fremantle line than any other line. There always seems to be plenty of people on the trains (even late at night), which makes me feel safer. You do sometimes get a few rowdy groups of young people heading to and from some of the nightspots on the route (Claremont, Subi etc) but I have never had a problem.