#!/usr/bin/perl use strict; use warnings; my $foo = "Hallo Test hallo"; (my $neue_var = $foo) =~ s/\s//g; print $foo;