HI there. i've tried chomp, trim, and string::util text::trim and i can't seem to get anything to work. I'm simply globing a directory of files into an array, then adding a "," to them and printing out the list. i am pushing the list of filenames with the comma added into an array using PUSH, but when i go to print the filenames back out their is trailing white space. But on line 30 when i print the filenames before they are pushed into the array the white space isn't there. i want to use the $baseurl, and list to produce a list 123.psd,345.psd,543.psd not 123.psd, 345.psd, 543.psd
#!/usr/bin/perl -w use File::Find; use File::Copy; use Net::SMTP; use File::Basename; use File::Slurp; use Net::FTP; use Email::Send::SMTP::Gmail; use String::Util ':all'; use LWP::Simple; use Cwd; chomp($myname = `id -un`); my $dir ="/Users/$myname/Desktop/"; my $logname = 'content.csv'; my $output = "> /Users/$myname/Desktop/$logname"; use POSIX qw(strftime); my $date = strftime("%m-%d-%y",localtime); my $time = strftime("%I:%M:%S",localtime); my $comma = ","; my $folder ="/Volumes/photorepos/Partners/NYCompany/post/instock/RUSH/ +"; chdir ($folder); (@files) = glob "*.psd"; foreach $file (@files){ print "$file".','; push @list,("$file".','); crunch(@list); }; my $baseurl ="http://trueaction.workhorsegroup.us/ServerExport.cfm?Con +figFile=ServerExportCfg-NYandCFileStatus.inc&FormatOverride=CSV&filen +ames="; open FILE, $output or warn "$!"; $content = ("$baseurl@list"); # print FILE "$content"; close FILE;

In reply to trailing white spaces when pushing into array 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.