"WATFOR Forever!" Anyway, I found an interesting pertinent link: http://marine.rutgers.edu/po/tools/perl.html I also played with your code and incorporated it into my mini project:
sub getFortranVarNames { # # Purpose: Find all variables in a list of FORTRAN declarations. # Preserve any array dimension information as a string for # later processing. Subroutine is based on response by # "Sandy" on perlmonks.org # # Return array is further massaged for array dimensions. my ($string) = @_; my @fields=(); my $open = 0; my $close = 0; my $a; my $i = 0; # \z TRUE at end of string only while (not $string =~ /\G\z/gc) { # --- get variable name # \G TRUE at end-of-match position of prior m//g # ?: cluster only parenthesis, no capturing # gc - allow continued search after failed /g match if ((not $open) and ($string =~ /\G(?:\s*|,)(\w+)/gc)) { $fields[$i]{name}=$1; $fields[$i]{dims}=''; $opt_debug and print "Name: $1\t"; $i++; # --- find opening brackets, and keep track of level } elsif ($string =~ /\G([^\)]*\()/gc) { $a = $1; $open++; } # --- find closing brackets, and print info elsif (($open) and ($string =~/\G\s*([^\(]*\))/gc)) { $opt_debug and print "-> $a$1\n"; $fields[$i-1]{dims}="$a$1"; $open--; } } return (@fields); }
When I get the whole thing done I may post it.

In reply to Re^2: f77 variable list parsing by SlugMass
in thread f77 variable list parsing by SlugMass

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.