Thank you sir,

I corrected my code.

Regards,
satya




"John W. Krahn" <[EMAIL PROTECTED]>
05/20/2004 05:28 PM

 
        To:     [EMAIL PROTECTED]
        cc:     (bcc: Satya Devarakonda/HAM/AM/HONDA)
        Subject:        Re: perlglob on Windows platform


Satya Devarakonda wrote:
> 
> Hi,

Hello,

> I am trying to delete zero byte files using the following code:
> 
> for ($i=0; $i<[EMAIL PROTECTED];$i++) {
               ^^
You are accessing a nonexistent element of the array.  If your array
contains ten elements then that will also use the eleventh element.  Why
not just loop over the elements of the array itself instead of using an
index variable?  If you really need an index variable then the perlish
way to do it is:

for my $i ( 0 .. $#filelst ) {


>                 $filelst[$i] =~ s/\s//;

You are removing a single whitespace character from the variable
$filelst[$i].  Is that what you really want to do?


>                 #Process creates zero byte file if nothing was found in
> the mailbox
>                 #Hence delete zero byte files
>                 if ( -z "$indir\\${filelst[$i]}" )
>                 {
>                         print " $indir\\$filelst[$i] \n";
>                         unlink <"$indir\\$filelst[$i]">;

You are enclosing "$indir\\$filelst[$i]" in <> which is a fileglob.  You
can also use / instead of \\ for path separators.

                if ( -z "$indir/$filelst[$i]" )
                {
                        print " $indir/$filelst[$i]\n";
                        unlink "$indir/$filelst[$i]";


>                         next;
>                 }..................


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to