[Za-pm] loop adding \n to array ??
Gregory Machin
gregory.machin at gmail.com
Wed Jun 28 22:37:33 PDT 2006
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;
#find all files starting with a plus
foreach (@tmp) {
$_ =~ s/$tmp_dir\/// ; # remove the path to the input working dir so
only
# the files and directories in the working dir are used
$_ =~ s/\/$//; #remove trailing "/"
# /^\+\w+/i filter all files starting with "+"
if ($_ =~ /^\+\w+/i ){ push(@del_files, $_); $_ = "0"; } # filter and
pass files starting with + to @del_files for removale
#print "$_";
if ($_ ne "0"){
push(@ctr_file , "$_");
print "$_";
}
}
Many thanks for you time
Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/za-pm/attachments/20060629/f2befec4/attachment.html
More information about the Za-pm
mailing list