Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^3: Range File Open

by amarquis (Curate)
on Mar 04, 2008 at 14:33 UTC ( [id://671886]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Range File Open
in thread Range File Open

You already have some code to scan through your directory and decide whether or not you want a file, so all you have to do is push the file into the array at the end of a similar loop. Something like the following:

while (my $file = readdir(DIR)) { #decide whether or not this is a file the user wants ... push @files, $file; }

Then you can use stiller's loop to iterate through that list, opening each file for processing.

Replies are listed 'Best First'.
Re^4: Range File Open
by Anonymous Monk on Mar 04, 2008 at 14:49 UTC
    How to get the range, lets say, in this directory I have 30 files, from day 1 to day 30, form this dropdown menu I select from day 5 to day 25, and then do the processing, open all the files between day 5 and day 25, how can I do that on this code?

      Well, you'd fill in the...

      #decide whether or not this is a file the user wants ...

      ... section with code that checked the files in the directory against what the user has selected. For example, you might look at the date part of the filename, and see if it is in the range that you get from the variables you already pull out of the user query ($get_file_from and $get_file_to)

      In pseudocode:

      foreach file in the directory { get the date from the filename check if it is in the $get_file_from to $get_file_to range if so, add it to @files } later foreach @files { open and process }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://671886]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-19 12:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found