use Data::Dumper; my @test=("aaa bbbbb cccc"); my @test = map { s/\s//g; $_ } @test; print Dumper(\@test);