#!/usr/bin/perl -w use strict; use warnings; use diagnostics; use File::Copy; my (@files) = (); my ($file) = 0; my ($directory) = "directory"; opendir (DIR, $directory) || die "could not open $directory: $!\n"; @files = grep {/^10/} readdir DIR; closedir DIR; print("You are moving the following files to another location\n"); foreach $file (@files) { print $file . "\n"; } my ($newlocation) = "target"; foreach my $file (@files) { move($file, $newlocation) || die "could not move files: $!\n"; }