I'm not sure I understand what you're saying?... Let's say I have the following

Um, that is not an array, or three arrays, you can't sort that. I too am completely unsure of what you're asking about. Does this help?

#!/usr/bin/perl -- use strict; use warnings; use Data::Dump; Main( @ARGV ); exit( 0 ); sub Main { my @choice = Ply( 0, 0, 0 ); dd\@choice; push @choice, Ply( 1, 1, 1 ); push @choice, Ply( 2, 2, 3 ); dd\@choice; print "Combinations ", int( @choice ),"\n"; print "Materials ", CountMaterials( \@choice ),"\n"; } sub CountMaterials { my( $co ) = @_; my %seen; for my $item ( @$co ){ my $mat = $item->[0]; $seen{ $mat }++; } return scalar keys %seen; } BEGIN { my @Thickness = ( "0.0077","0.0147","0.0054"); my @Material = ( "PW","8HS","Tape"); my @Orientation = ("-45","0","45","90"); sub Ply { my( $mat, $thi, $ori ) = @_; return [ $Material[ $mat ], $Thickness[ $thi ], $Orientation[ $ori ], ]; } } __END__ [["PW", 0.0077, -45]] [["PW", 0.0077, -45], ["8HS", 0.0147, 0], ["Tape", 0.0054, 90]] Combinations 3 Materials 3

All you have to do is write a function to query the target option menu and return an array like CountMaterials expects


In reply to Re^3: Create an array from Optionmenu variables by Anonymous Monk
in thread Create an array from Optionmenu variables by shortyfw06

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.