Hello, i'm trying to remove the suffix from a list of filenames. what is the best way to apply the basename module to a list of files.?
#!/usr/bin/env perl use Net::FTP; use File::Copy; use Mail::Sender; use Net::SMTP; my $TIFFfolder = "/Volumes/photorepos/Partners/LTBrands/post/DONE_PSDs +/"; chdir( $TIFFfolder ) or warn "Cant chdir to $TIFFfolder $!"; my(@TIFFfolder_list) = glob "*.psd"; print "$date $time Removing any Thumbs.db files from $TIFFfolder\n"; if ( -e "Thumbs.db") { unlink ("Thumbs.db") or warn "thumbs.db is being a pain in the ass: $! +\n"; } my $TIFFapproval = @TIFFfolder_list; foreach $file (@TIFFfolder_list){ my $file = basename (@TIFFfolder_list, ".psd"); print "$file\n"; } $mail->send(-to=>"$to", -from=>"$from", -subject=>"$subject", -body=>" +$file", -contenttype=>"text/html"); $mail->bye;
when i run this the print function will print the same filename for as many times as there are files it globbed, and doesn't make it into my email. LT-AG4437_AH66-FLAT LT-AG4437_AH66-FLAT LT-AG4437_AH66-FLAT LT-AG4437_AH66-FLAT LT-AG4437_AH66-FLAT LT-AG4437_AH66-FLAT LT-AG4437_AH66-FLAT LT-AG4437_AH66-FLAT LT-AG4437_AH66-FLAT LT-AG4437_AH66-FLAT

In reply to using basename on a list of filesnames 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.