This is the code I have written, Many of the variables are not being used yet.
#!/usr/bin/perl use strict; use warnings; use Getopt::Long; my $sect_name = ""; # Name of section my $sect_unit = ""; # Units defaults to inches my $sect_depth = 0; # Distance from origin my $sect_plane = ""; # Plane, defaults to X-Y plane my $sect_num = 0; # Number of points my $file_name; my $fh; my $help = 0; my $_debug = 0; my $val1 = 0; my $val2 = 0; my %vector_hdr; # Headr information hash list my @vector_pts = (); # Array of x,y coordinates my $vector_str = ""; # my $top = 'xy'; my $bottom = 'yx'; my $right = 'zy'; my $left = 'yz'; my $front = 'zx'; my $back = 'xz'; GetOptions( 'file_name=s' => \$file_name, 'sect_name' => \$sect_name, 'sect_unit' => \$sect_unit, 'sect_depth' => \$sect_depth, 'sect_plane' => \$sect_plane, 'sect_num' => \$sect_num, 'help' => \$help, 'debug' => \$_debug, ); if(!$file_name){ print "No file was specified $!\n"; help(); exit; } #open file open($fh, $file_name) or die "Failed to open file $file_name: $!"; #process file content my $line_in; my $key; my $value; my $seq_num = 0; my $max = 0; my $plane; my $coord_x; my $coord_y; my $coord_z; while($line_in = <$fh>){ chomp $line_in; if($_debug){print "processing: $line_in\n";} if($line_in =~ m/^sect_/){ ($key, $value) = split(' ', $line_in); $vector_hdr{ $key } = $value; } else { # Put coordinates into 3D array # need test to skip lines with no data ($val1, $val2) = split(' ', $line_in); if($vector_hdr{'sect_plane'} =~ m/xy/){ $vector_pts[$seq_num][1] = $val1; $vector_pts[$seq_num][2] = $val2; $vector_pts[$seq_num][3] = $vector_hdr{'sect_depth'}; } # plot on front plane if($vector_hdr{'sect_plane'} =~ m/zx/){ $vector_pts[$seq_num][1] = $val2; $vector_pts[$seq_num][2] = $vector_hdr{'sect_depth'}; $vector_pts[$seq_num][3] = $val1; } # Plot on side plane if($vector_hdr{'sect_plane'} =~ m/zy/){ $vector_pts[$seq_num][1] = $vector_hdr{'sect_depth'}; $vector_pts[$seq_num][2] = $val2; $vector_pts[$seq_num][3] = $val1; } $seq_num = $seq_num + 1; } } exit;

In reply to Re: Managing structured data by salp
in thread Managing structured data by salp

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.