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

I am not noted for my introduction. However,is my first request of the Monastery and I feel a short one is due.

I have been working with perl on several platforms for the past few years. I strive to someday reach a high level in perl and feel that I am on a good path.

However, I have run into a limitation problem or so it seems. I have always thought that there are no limitations in perl, that limitation came from the environment, is this true?

I would greatly appreciate it if someone could explain why the following one line script only prints the last two and a half of the input arguments when given over 258 chars:
perl -e '$_=<STDIN>; foreach(split){print "$_\n"}'
ARGUMENTS LIST ENTERED TO STDIN:
2 words 64 && 2 words 65 chars each works
adding a character to any work breaks something?

Any input will be appreciated.

Thank you for your time,
Malus

PS
Thank you for making the world a better place ;)

ENVIRONMENTAL FACTORS:
perl v5.6.1 build for sun4-solaris
Solaris7
ULTRA5

Edit by tye to unhide the <STDIN>

Replies are listed 'Best First'.
Re: Is there a limit on STDIN string size 259?
by MZSanford (Curate) on Nov 15, 2001 at 14:24 UTC
    i think jeroenes has got it. I have a group of Solaris machine (varying versions), and the ksh that comes with the OS has a command line limit of 256 charcters from what i have seen. To run any command longer than that, i have to break it up using \'s, switch shells, or put the command into a file and run it (as it only appears to be an interactive ksh problem). If you are not using ksh, then i would still take a look into this problem on whichever shell you are using, as it is possible they all share this on Solaris.
    i had a memory leak once, and it ruined my favorite shirt.
      Yes, I am using the ksh for solaris 7.

      When entering into <STDIN> is that passing
      through the korn shell? I can't seem to escape that \$
      end of line character. Is there a way around this without
      using a test file? (a file is looking like a fine idea right
      about now though)

      Thank you for you help.
      Malus

      PS
      I have repeated my problem on the following:
      SunOS 4.1.4 sun4m: perl v5.6.1 sun4-sunos
      IRIX 6.5 IP32: perl v5.004_04
      HP-UX B.11.00 9000/785: perl v4.0.36 (breaks on the 8th 65char string)
      HP-UX B.10.20 9000/785: perl v5.6.1 PA-RISC1.1 (breaks on 8th, also)
      FreeBSD 4.3 i386: perl v5.005_03 i386-freebsd (breaks on 16th word, 65char)

Re: Is there a limit on STDIN string size 259?
by blakem (Monsignor) on Nov 15, 2001 at 09:51 UTC
    hmm.. it works fine on my machine... does this work for you?
    (you should surround your code with <code> tags..)
    % perl -e 'print join(" ",map $_->[0]x$_->[1], (["a",64],["b",64],["c" +,65],["d",65]))' | perl -e '$_=<STDIN>; foreach(split){print "$_\n"}' =head1 OUTPUT aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd

    -Blake

      blakem, I think he ment that this was the largest string he could handle. For good measure, I ran your line with the numbers 274,74,85,85 and it works on my box.

      I repeated this with yesterdays framechat log (nice and long textfile):

      perl -e '$a=join "", <STDIN>; $a=~tr/\n/ /s; print $a'\ </tmp/20011113.txt | \ perl -e '$_=<STDIN>; foreach(split){print "$_\n"}' | less
      Works. Would this mean that there is an issue with the solaris shell?

      Jeroen