Your code is completely absent any meaningful indenting.
} } } }
Is not good programming style. There are number of acceptable indenting methods, I show one of them below. Every closing "curly brace" should be easy to match up with the opening "curly brace". I did not modify your code, but just added whitespace for clarity. (oops, I think you did miss one curly brace) Believe it or not, whitespace is some of most important "code" that you can write.
foreach $file (@filesforeach) { print "$file\n"; open(my $fh, "<", "$filenames_to_putback") or warn "$!\n"; while (my $row = <$fh>) { chomp $row; print "$row\n"; my @line = $file; for (@line) { if ($_ =~ /$row/) { chomp $_; # push @output, "found $_ that matched redo $file $row <br +>"; move($_,$row) or warn "shit went wrong yo! $!\n"; } } } } # print "@output\n";
All of the "warn" messages should be "die". "warn" just prints a message and continues. warn "$!\n" You probably don't know this but adding the explicit "\n" suppresses the Perl line number of the error. Don't add the "\n" unless you understand what it does. There are uses for this when dealing with unsophisticated users, but in general leave Perl "line of error" reporting on.

In reply to Re: glob a folder of images, and open text doc, find the matches and move the images. by Marshall
in thread glob a folder of images, and open text doc, find the matches and move the images. by flieckster

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.