<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Array restrictions with set -A in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/array-restrictions-with-set-a/m-p/3091602#M806553</link>
    <description>1024 is the maximum size of an array with the shell.&lt;BR /&gt; &lt;BR /&gt;If you want more, you are either going to handle two arrays (which could get quite nasty) or start again with perl :)</description>
    <pubDate>Mon, 13 Oct 2003 05:23:27 GMT</pubDate>
    <dc:creator>Mark Grant</dc:creator>
    <dc:date>2003-10-13T05:23:27Z</dc:date>
    <item>
      <title>Array restrictions with set -A</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/array-restrictions-with-set-a/m-p/3091601#M806552</link>
      <description>I've found that using set -A Arrayname, there appears to be a limit of 1024, producing the error 'ksh: 1025: subscript out of range', when &amp;gt; 1024 entries are encountered. &lt;BR /&gt;&lt;BR /&gt;Is my assumption true, and is there any way of increasing the array subscript, or any alternative methods</description>
      <pubDate>Mon, 13 Oct 2003 05:19:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/array-restrictions-with-set-a/m-p/3091601#M806552</guid>
      <dc:creator>Chris Baugh</dc:creator>
      <dc:date>2003-10-13T05:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Array restrictions with set -A</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/array-restrictions-with-set-a/m-p/3091602#M806553</link>
      <description>1024 is the maximum size of an array with the shell.&lt;BR /&gt; &lt;BR /&gt;If you want more, you are either going to handle two arrays (which could get quite nasty) or start again with perl :)</description>
      <pubDate>Mon, 13 Oct 2003 05:23:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/array-restrictions-with-set-a/m-p/3091602#M806553</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-10-13T05:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Array restrictions with set -A</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/array-restrictions-with-set-a/m-p/3091603#M806554</link>
      <description>From the manpage at &lt;A href="http://docs.hp.com/hpux/onlinedocs/B2355-90680/B2355-90680.html" target="_blank"&gt;http://docs.hp.com/hpux/onlinedocs/B2355-90680/B2355-90680.html&lt;/A&gt;&lt;BR /&gt;"&lt;BR /&gt;The value of all subscripts must be in the range of 0 through 1023&lt;BR /&gt;"&lt;BR /&gt;You could try another shell.&lt;BR /&gt;/usr/dt/bin/dtksh is pretty high-powered, although I haven't checked it out.&lt;BR /&gt;Awk would be ok - it's array subscripts are strings, and so can be anything.&lt;BR /&gt;-- Graham</description>
      <pubDate>Mon, 13 Oct 2003 05:27:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/array-restrictions-with-set-a/m-p/3091603#M806554</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-10-13T05:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Array restrictions with set -A</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/array-restrictions-with-set-a/m-p/3091604#M806555</link>
      <description>1024 is the limit and, in general, when you need arrays bigger than this, the shell is going to be a dog. As has been suggested, it's time to look at awk or better still Perl. Perl actually has two types of 'arrays' -- arrays and hashes. Arrays are indexed 0-n but hashes are like awk's associative arrays so that the indices might literally be 'Red', 'Green', 'Turnips', 0, 4, ... . One more thing to note if your are using awk or Perl, the default arithmatic is floating-point by default so that if you are computing array indices 10/4 = 2.5 rather than 2 (the shell uses ONLY integer arithmatic).&lt;BR /&gt;</description>
      <pubDate>Mon, 13 Oct 2003 08:16:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/array-restrictions-with-set-a/m-p/3091604#M806555</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-10-13T08:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Array restrictions with set -A</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/array-restrictions-with-set-a/m-p/3091605#M806556</link>
      <description>I aggree with the others that when you have to use such big arrays you'd better use Perl for scripting.&lt;BR /&gt; &lt;BR /&gt;However, though it is true that generally, if not told otherwise, Perl will do floating point arithmetics it is safeguarding against insensible input and silently corrects the programmer.&lt;BR /&gt; &lt;BR /&gt;Here an example from the Perl debugger:&lt;BR /&gt; &lt;BR /&gt;main::(-e:1):   0&lt;BR /&gt;  DB&amp;lt;1&amp;gt; @a=0..9&lt;BR /&gt;&lt;BR /&gt;  DB&amp;lt;2&amp;gt; x @a&lt;BR /&gt;0  0&lt;BR /&gt;1  1&lt;BR /&gt;2  2&lt;BR /&gt;3  3&lt;BR /&gt;4  4&lt;BR /&gt;5  5&lt;BR /&gt;6  6&lt;BR /&gt;7  7&lt;BR /&gt;8  8&lt;BR /&gt;9  9&lt;BR /&gt;  DB&amp;lt;3&amp;gt; p $a[10/4]&lt;BR /&gt;2&lt;BR /&gt;  DB&amp;lt;4&amp;gt; x @a[2.9,3.1]&lt;BR /&gt;0  2&lt;BR /&gt;1  3&lt;BR /&gt;  DB&amp;lt;5&amp;gt; p 10/4       &lt;BR /&gt;2.5&lt;BR /&gt;  DB&amp;lt;6&amp;gt; ;{use integer; print 10/4,"\n"}&lt;BR /&gt;2&lt;BR /&gt;&lt;BR /&gt;  DB&amp;lt;7&amp;gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;Since fractional array indices don't make so much sense we can usually live with this.&lt;BR /&gt;As you can see from above you can always tell Perl to do integer arithmetics through the "use integer" pragma.&lt;BR /&gt;a "no integer" or end of block should return to floating point arithmetics.&lt;BR /&gt; &lt;BR /&gt;A very nice feature of Perl is its "autovivification" and garbage collection.&lt;BR /&gt;A statement like &lt;BR /&gt;@a = 1000..4999 &lt;BR /&gt;will create you a 4000 element array on the fly.&lt;BR /&gt;You could als use C-shell like globbing to fill e.g. an array of filenames (provided you have some hundred files ending on log)&lt;BR /&gt; &lt;BR /&gt;@files = ;&lt;BR /&gt; &lt;BR /&gt;The same feature works in list context on file handles if you need to read from a file handle into an array.&lt;BR /&gt; &lt;BR /&gt;Besides this you can build up the most complex Lists of Lists.</description>
      <pubDate>Mon, 13 Oct 2003 10:02:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/array-restrictions-with-set-a/m-p/3091605#M806556</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2003-10-13T10:02:20Z</dc:date>
    </item>
  </channel>
</rss>

