now I would expect this to return the filename followed by the file size and a value of 1 if it is a directory. which works great on 5.8.0 Active State... However when I run the same code on AIX running 5.005_3 I get "strange" results. the filename, size, and directory indicator are returned for '.' and '..' but every file or directory after that a size and directory indicator are not returned? I check 'perldoc -f -s' on the AIX box and it appears that the file test operators should work the same on 5.005_3 as they do on my windows box....??? can anybody shed some light on this for me?#!/usr/bin/perl -w use strict; my $dir = "."; # relative path within chroot opendir(DIR, $dir) or die "can't open $dir for read: $!\n"; my @file = readdir DIR; closedir(DIR) or die "error closing $dir: $!\n"; foreach my $file (@file) { my $fsize = (-s $file); # get the file size my $isdir = (-d $file); # get the file size if ($fsize > 1 || $isdir =~ 1) { print ":$file:$fsize:$isdir:\n"; ...do more junk.... } else { print ":$file:$fsize:$isdir:\n"; ...do more junk.... } }
In reply to file size test on 5.005_3? by djbiv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |