kelder has asked for the wisdom of the Perl Monks concerning the following question:
Thus I have a problem. My input list is too long for my program to pipe in. What other solutions do I have? Is using @ARGV still a good idea, or do I have to look at another avenue? UPDATE!!!: I got my code to work! Thanks especially to Corion for recommending tye's sort function. Basically, this is how it played out:-bash: /usr/bin/perl: Argument list too long
Using this format, I was able to still use the <> operator, while piping in a sorted ARGV, so my output came out like this:@ARGV=glob my $pattern; my @files=@ARGV; my @sorted = @file[ map { unpack "N", substr($_,-4) } sort map { my $key = $file[$_]; $key =~ s[(\d+)][ pack "N", $1 ]ge; $key . pack "N", $_ } 0..$#file ]; @ARGV=@sorted; while (<>) { Do my function } if (eof(ARGV)) { Do end of file cleanup }
This is exactly what I wanted. Thanks for all the help!file1 file2 .... file10 file11
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multiple file input into a perl script
by Corion (Patriarch) on Sep 30, 2008 at 18:46 UTC | |
by kelder (Novice) on Sep 30, 2008 at 19:01 UTC | |
by Corion (Patriarch) on Sep 30, 2008 at 19:47 UTC | |
by broomduster (Priest) on Sep 30, 2008 at 22:11 UTC | |
by Corion (Patriarch) on Oct 01, 2008 at 05:42 UTC | |
| |
by kelder (Novice) on Sep 30, 2008 at 19:53 UTC | |
by Corion (Patriarch) on Sep 30, 2008 at 19:58 UTC | |
by kelder (Novice) on Sep 30, 2008 at 20:25 UTC | |
by Corion (Patriarch) on Sep 30, 2008 at 20:33 UTC | |
|
Re: Multiple file input into a perl script
by toolic (Bishop) on Sep 30, 2008 at 18:49 UTC | |
|
Re: Multiple file input into a perl script
by Perlbotics (Archbishop) on Sep 30, 2008 at 19:11 UTC | |
|
Re: Multiple file input into a perl script
by graff (Chancellor) on Oct 01, 2008 at 04:03 UTC |