http://www.perlmonks.org?node_id=11128802


in reply to Move a file to another directory based on regex match

Start simple:
I may be wrong, but I think your regex is wrong.
'+' is not a valid file name character.
Start by printing the proposed files to be moved:
I don't know what \+ means?
#!/usr/bin/perl use strict; use warnings; use File::Copy; my ($inDir, $outDir) = @ARGV; opendir (DIR, $inDir) or die "Bad Input Directory $inDir $!\n"; while (my $infile = readdir(DIR)) { if ($infile =~ 'F\d{8}\.\d{4}\+\d{4}\-\d{4}\+\d{4}_.*') #like F12345678.1234+1234-9876+3456..... { print "$inDir/$infile\n"; } }