in reply to splitting up data...

If you only need a rough estimation of the split files, you can use the input file size and tell to figure out where in the input file you are and when to split. This should save you from needing to read through the file twice.

Another option is to open up all output files at the start and just cycle through writing one input line to each output file in turn. This should also save you from needing to read through the file twice.

Finally, you mention @ARGV which has me a little confused. If the list of words is coming in @ARGV, I believe most OS have a limit to how many ARGS you can pass to a process, which is generally pretty low. I'm assuming your changing from passing in words via @ARGV to using a file.

Fendaria

Replies are listed 'Best First'.
Re^2: splitting up data...
by chinamox (Scribe) on Oct 22, 2006 at 06:07 UTC

    Thank you for your response

    I am planning on using @ARGV to pass a large list of words from a file. The command line would look something like this:

    username $: perl thisprogram.pl -4 /myfiles/lists/names_data

    I thus @ARGV would be passing the list of names contained in the file named names_data. I am then looking to divide the file equally by a number given in the command line (4 in this case) and printing the resulting files into my current directory. I was just looking for a simple way of dividing the files.

    Sorry for any confusion.

    -mox