use File::Path; use File::Copy; : : {mumble..mumble} much handwaving foreach my $line(@lines){ # flip the 0 to a 1 if you want verbose output # see text below for what 0755 means. mkpath([ "$pparent/$path/images" ],0,0755) if not -d "$pparent/$path/images"; copy ("$GraphicsDirectory/$line", "$pparent/$path/images/$line"); }