Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Help with splitting one text file into other text files

by moritz (Cardinal)
on Mar 30, 2011 at 15:30 UTC ( #896441=note: print w/ replies, xml ) Need Help??


in reply to Help with splitting one text file into other text files

You can store file handles in hashes, something like

use autodie; my %handles; for (1996..2011) } open $handles{$_}, '<', "$_.sec"; } ... print { $handles{$year} } $yourdata;


Comment on Re: Help with splitting one text file into other text files
Download Code
Re^2: Help with splitting one text file into other text files
by Fletch (Chancellor) on Mar 30, 2011 at 15:35 UTC

    Depending on the OS and the number of simultaneous handles you need FileCache might also be of interest.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      Or FileCache::Handle, but what is really needed, is a lexically scoped pragma like autodie, so you can
      use autofilecache; use autodie; my @Fs; for(1..1024){ open my($f),'<',$_; push @Fs, $f; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2014-08-31 01:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls