my $element $element = substr $element, 0, -4 foreach $element @list; #You will still need to add the space though. #This solution is not that plausible.