stoba has asked for the wisdom of the Perl Monks concerning the following question:

I've been helping a colleague a bit with a perl script he has been writing. He has a very long list of arguments (about 2000 items) being passed to qw(). He is finding that only about the first 900 items are quoted. Is there a known limitation on the maximum number of items that can be quoted in this way? He's running the current build of MacPerl under MacOS 9.2.2. Many thanks in advance.

Replies are listed 'Best First'.
Re: Maximum number of arguments for qw()?
by Ovid (Cardinal) on Apr 16, 2002 at 22:35 UTC

    Could you be more precise? What do you mean by "quoted"? Is it apparently dropping values or something? qw// does not "quote" values for you in the way that $dbh->quote() does, for example. If you can give us some more context and explain what is being attempted, we can help you better.

    Just to make sure I wasn't missing anything, though, I wrote a small code generator. This writes out a program that generates 1000 strings that get passed to an array. Run this, run the resulting program, and then examine the output file (out.txt). You'll see that all of the values were properly added to the array.

    #!/usr/bin/perl -w use strict; open TEST, "> test.pl" or die $!; my $string = "xxx " x 1000; print TEST <<END_PERL; #!/usr/bin/perl -w use strict; my \@string = qw/$string/; open TEST, "> out.txt" or die \$!; for (0..999){ print TEST "\$_ \$string[\$_]\\n"; } close TEST;

    Incidentally, if someone is trying to use qw// with over 900 items, I would suggest that there are better ways to handle this (such as writing that data to a file and reading it in later). It sounds like a design problem in the program may be contributing to the confusion.

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Re: Maximum number of arguments for qw()?
by Mandor (Pilgrim) on Apr 16, 2002 at 22:40 UTC
    What do you mean exactly by "passed to qw()" and "quoted"? Could you be more specific or show us some code to refer to?