in reply to How to process only files created on specific month?

I assume that by "create" you mean the mtime shown in your ls output. You can use stat and localtime to get what you want.

while (<*Dec2003*.txt>) { # this is a glob if ( (localtime( (stat)[9]))[4] == 11 ) { # open $_ and process it } }

Update: Not_a_Number++ is correct. Repaired.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: How to process only files created on specific month?
by Not_a_Number (Prior) on Jan 23, 2004 at 21:40 UTC
    if ( (localtime( (stat)[9]))[4] == 12 )...

    I think you mean:

    if ( (localtime( (stat)[9]))[4] == 11 )...

    ...since month numbering starts from zero (for January)

    :-)

    dave

Re: Re: How to process only files created on specific month?
by danield (Novice) on Jan 23, 2004 at 21:05 UTC
    Hello Zaxo,
    how would you include the oposite situatuion? (File with name November, but with mtime shown sa December) In one script? Thank you.

      I'd quit messing with file names and just go by mtime. Here's a way to make an AoA of file names.

      my @files; while (<*.txt>) { push @{$files[ (localtime +(stat)[9])[4] ]}, $_; }
      That gives you the November files as @{$files[10]}. You may want to rewrite that to take account of years, too. A hash may be more convenient than an array.

      After Compline,
      Zaxo