Hi,
I'm trying to write an OO module which has an attribute of file operators to
test against.
opendir (my $DIR, $path) or _carp("Can't opendir $path ($!)\n");
my @contents = readdir ($DIR);
closedir $DIR;
my @dirs = grep {-d} File::Spec->no_upwards(@contents);
my @bad_files = grep {$self->{"_FILE_ATTR"}} @contents;
my @good_files = grep {-T} @contents;
print "Flags: $self->{_FILE_ATTR}\n\n";
print "Bad: @bad_files\n\n";
print "Good: @good_files\n";
This produces:
Flags: -T
Bad: . .. AutoTest CVS cw_stationery demos doc drivers include initialization
lib Release Notes.txt SmartDSP OS_release_note.doc source tests tools training
Good: Release Notes.txt
Do you know why there is a difference between the two grep operation outputs?
This is perl, v5.10.0 built for MSWin32-x86-multi-thread (with 5 registered
patches, see perl -V for more detail)
Copyright 1987-2007, Larry Wall
Binary build 1003 [285500] provided by ActiveState http://www.ActiveState.com
Built May 13 2008 16:52:49
Best Regards,
Dov Levenglick
SmartDSP OS Development Leader,
DevTech, Technology and System Organization
Freescale Semiconductor Israel
Tel. +972-9-952-2804
The information contained in this email is classified as:
[ ] Freescale General Business Information
[x] Freescale Internal Use Only
[ ] Freescale Confidential Proprietary
[ ] Personal Memorandum
SAVE PAPER - THINK BEFORE YOU PRINT
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl