This is often attributed to Winston Churchill, who as First Sea Lord is said to have growled "Don't talk to me of the Navy's 'tradition'. It's nothing but rum, sodomy, and the lash." It's not at all clear that he said it, but as with many famous wits (including Mark Twain) he gets credit.
What is a cold stone fact is that rum has not been issued in the Royal Navy since July 31, 1970. The original 17th Century ration of a gallon of beer a day was replaced with a half pint of rum to save space on board. Concerns about drunkenness led that ration to first be mixed with water ("Grog" was four parts water to one part rum) and then cut to a quarter pint a day, then an eighth pint. In the late 19th Century the Officer's ration was eliminated, and Warrant Officers saw theirs ended at the end of World War I.
But ratings continued to get their daily ration up until "Black Tot Day" in 1970, when rum rations were finally ended for all personnel. It is said that some sailors wore black arm bands, and some Tots (ration flasks) were given a burial at sea.
The lash had been missing from the fleet for only a brief time by then. The notorious "Cat o' Nine Tails" lash had not been used since 1881, and had been removed from the statute book officially in 1949. Caning with birch was maintained until 1955 in the general fleet, and until 1967 on training ships. "Twelve of the best" was a typical punishment nearly until we landed a man on the moon.
Alas, I find no credible reports as to the prevalence of sodomy in the Royal Navy. Fortunately, however, cannibalism is mostly under control.