Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

The following snippet will do what you want.

#!perl -w use strict; use Cwd; use Win32::File qw(GetAttributes); use constant HIDDEN => 2; my $attribs; my $dir = cwd(); print $dir,$/; opendir( DIR, $dir ) or die "Couldn't open $main::DIR: $!\n"; my @vis_files = grep { -f $dir.'/'.$_ and GetAttributes($_, $attrib +s) and not ($attribs & HIDDEN) } readdir(DIR); closedir( DIR ) or warn "Couldn't close $main::DIR: $!\n"; print $_, $/ for @vis_files;

Now, I KNOW I shouldn't have to be defining my own HIDDEN constant, as this and all the others are apparently exported into main by Win32::File.

However, I have tried everything to use these exported constants including:

  • Win32::File::HIDDEN
  • $Win32::File::HIDDEN

and either get 'bareword; noises, or if I turn off strict 'not numeric' noises.

I also investingated and whilst there is a qw( list ) of the constant names exported, I can see nowhere where they aquire any values?

Anyone who can explain

  1. How to use them?
  2. How they (are meant) to aquire values

Will earn the customary ++ and my grateful thanks.

In reply to Re: filtering hidden files on Win32 by BrowserUk
in thread filtering hidden files on Win32 by jjdraco

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2021-06-13 10:42 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (54 votes). Check out past polls.