[Israel.pm] What am I missing

Ephraim Dan E.Dan at F5.com
Thu Oct 15 00:40:19 PDT 2009

You're missing string "eval" but there is probably a better way to go about it...

-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On Behalf Of Levenglick Dov-RM07994
Sent: Thursday, October 15, 2009 09:20
To: Perl in Israel
Subject: [Israel.pm] What am I missing

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

Perl mailing list
Perl at perl.org.il

More information about the Perl mailing list