Re: [SLUG] simple perl script problem

From: aaron steimle (asteimle@washpat.com)
Date: Wed Mar 09 2005 - 16:43:50 EST


It will not print any part of the @fileinfo array..but what is really
happening is stat will not work on the $filename variable.
Just change the DIR and run it yourself.

Eben King wrote:

>On Wed, 9 Mar 2005, aaron steimle wrote:
>
>
>
>>Can anyone tell me why this code will NOT work? I have look every where
>>and tried every combination of syntax I could find. This code is
>>basically a copy of every example I can find. I know there are other
>>ways to do this but I want to know why THIS isn't working.
>>
>>
>>
>>==================================
>>
>>#!/usr/bin/perl
>>
>>opendir DIR, "/var/errors/";
>>
>>while ( $filename = readdir(DIR) )
>> {
>> @fileinfo=stat($filename);
>> $sizestat = $fileinfo[7];
>> print "$filename - $sizestat\n";
>> }
>>closedir DIR;
>>
>>
>
>What error(s) do you get?
>
>
>

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:25:58 EDT