[Za-pm] loop adding \n to array ??

Nick Cleaton nick at cleaton.net
Thu Jun 29 01:53:07 PDT 2006


On Thu, Jun 29, 2006 at 07:37:33AM +0200, Gregory Machin wrote:
> Hi
> I have been writing a script to pass a directory the remove all the files
> starting with "+" and put them in a  an array @del_files and all the
> remaining in an array @ctr_file
> The problem Im having is that where the +FILE 's used to be I get blank
> lines with "\n"  in the @ctr_file, which I don't want .
> 
> find sub { push(@tmp ,$File::Find::name, -d && '/', "\n") }, $tmp_dir;
                                            ^^^^^^^^^^^^^^

For each file that gets found you're putting 3 elements into @tmp:

  1) the name of the file
  2) "/" if the file is a directory, the empty string otherwise
  3) "\n"

So that is where the "\n"s are coming from.


Nick

-- 
$_='7eeYiU***  http://www.exonetric.com/  Telehouse UK colo  ***9l?RP**'
.'#3o#kO"Ri***    GBP 34 per month +VAT for 1U + 40G BW     ***J(Xg**'
.'KPcK`16vsk***                                            ***mMk**'
;s/(.)(.*(.))/$2.chr(32+(ord($1)+ord$3)%89)/euntil/Foo/;eval#****'


More information about the Za-pm mailing list