#!/usr/bin/perl use strict; use warnings; open(my $fh, ">> uuu.txt") || die "cant open the file"; chomp $fh; $fh =~ s/\s//g; close $fh;