% ls -l drwxr-xr-x 2 hv hv 4096 Aug 10 2015 Desktop drwxrwxr-x 3 hv hv 4096 Sep 15 2020 'My Games' #### % ls -l -Q drwxr-xr-x 2 hv hv 4096 Aug 10 2015 "Desktop" drwxrwxr-x 3 hv hv 4096 Sep 15 2020 "My Games" #### my %OldFile; for my $file (@OldPicList) { $file =~ s{^\s+|\s+$}{}g; $oldFile{$file} = 1; } my @NewPicFolders; for my $file (@NewPicList) { $file =~ s{^\s+|\s+$}{}g; if ($oldFile{$file}) { # nothing } else { push @NewPicFolders, $file; } }