Marlins president of baseball operations Larry Beinfest made the announcement shortly after his team lost, 3-2, to the Braves in 10 innings at Sun Life Stadium.
The Marlins are mired in a seven-game losing streak, with six of those contests being decided by one run.
Perez is the son of baseball Hall of Famer Tony Perez, who is a Marlins' special assistant to the president.
"It's been very frustrating," Beinfest said. "I know the guys are frustrated. We're frustrated. We need to find a way to execute and score runs when we have that opportunity."
Since sweeping the Giants in San Francisco on May 26, the Marlins are 2-10. A common thread throughout the slump has been an inability to hit with runners in scoring position. Florida is batting .171 (19-for-111) in those situations during their past 12 games. The only team with a lower average in that span is the Indians, who have a .147 average.
Mallee, who had been in the Marlins' system for 10 years, was promoted from Minor League instructor to hitting coach last June 23 when the team replaced Fredi Gonzalez as manager with Edwin Rodriguez.
Although Mallee never played in the big leagues, he was widely respected throughout the organization. At the Minor League level, Mallee worked with all of the Florida-bred prospects, including Gaby Sanchez, Logan Morrison, Mike Stanton and Chris Coghlan.
Marlins players were informed by general manager Michael Hill afterward about the staff move.
"It's definitely not his fault that we're not scoring runs," said Morrison, who took the news hard. "We let him down. It's disappointing. I hope he lands on his feet.
"I wasn't caught off guard, just because I know kind of the inside track. I don't think it's right. I don't think it's just. He had us prepared more than anybody I've ever been prepared with. Half this team is made up with guys who have been through the system."
Even though the transaction occurred on Wednesday night, Beinfest said the decision was made beforehand.
As a team, the Marlins are hitting .248 with a .321 on-base percentage.
The one player who has had the roughest time is Hanley Ramirez, a three-time All-Star and the 2009 National League batting champion. Ramirez, who is on the disabled list with a left back sprain, is batting .210 with four home runs and 17 RBIs.
"John's been with us for a long time, over 11 years, came with us from Montreal [Expos], valued employee did a great job with a lot of our young players in the Minor Leagues," Beinfest said.
"We're just looking for a way to get this team offensively going. I certainly don't want to put it all on John and don't want to put it all on Eduardo, but we need to find a way to score some runs. We need to execute better and just all around we need to keep making progress with some of our young players and find a way to score runs consistently."
Perez, 41, made his Major League debut July 27, 1993, after playing collegiate ball at Florida State University.
In his 13-year playing career, he hit .247 with 79 homers and 294 RBIs. Perez spent time with the Angels, Reds, Cardinals, Rays, Indians and Mariners. His last Major League season came in 2006.
The former first baseman and outfielder spent time coaching Puerto Rico in the World Baseball Classic, and he has coached in the Puerto Rican Winter Leagues.
"[It's a] tough decision that will hopefully benefit this ballclub, and we're excited about Eduardo," Beinfest said. "Obviously, we know Tony, but Eduardo's intelligent. I think he's one of those guys that he's going to be good at anything he does -- whether he's a baseball player or a broadcaster or an instructor. I think he's just going to be good at anything he does, and I think he's going to do very good at this job."
Beinfest called Perez a great communicator and presence that will enjoy working with the young players on the team. Perez will be at the ballpark for Thursday night's series finale against Atlanta.
"It's a great opportunity for him, and I think it's a great opportunity for this organization to bring in somebody with the talent that Eduardo has," Beinfest said. "Obviously this is a very tough stretch for us right now, something we have to fight through. It's a tough situation, but we look forward to him joining us tomorrow."
Perez has familiarity with Marlins manager Edwin Rodriguez. Both are from Puerto Rico.
Replacing Mallee also hit Rodriguez hard because the two maintain a close friendship.
"For me, this is very tough," Rodriguez said. "Not only have I been working with him for many years, but on a personal level, he's a good friend. It was a tough decision. And from the players, he's been working with a lot of those players since they broke in the professional level.
"I know it's going to be very tough for [the players]. But it's a process, and for a lot of them, it's going to be their first experience. For a lot of them, they have to go through the whole process."