(Fyi: your post came through in a tiny (illegible) font.)



> #!/usr/sbin/perl

I recommend you start your scripts:

    #!/usr/sbin/perl -w
    use strict;

This will help identify a lot of basic mistakes.




>         if ($line =~ /^([^      ]+)\s+([-a-zA-Z*.]+) *$/) {

The [^    ] bit is the same as [^ ], ie with one space.
It would more typically be written:

    \S

The [-a-zA-Z*.] means a minus, or any letter, or an asterisk, or a
period.





>        if (! $alignment{$1}) {

$alignment{$i} is never set, so it'll never be true.



>             push (@{$ALIGNMENT{$1}}, split("", $line));

$ALIGNMENT{$1} is also never set, so it'll never contain
anything. Note that %alignment and %ALIGNMENT are
not the same hash. (Case is significant in Perl.)



You seem to be mixing up regular arrays (which have
numbered subscripts and are declared with my @array)
and hashes (which have named subscripts and are
declared my %hash). At a glance, you don't need to
use arrays anywhere.

    my %hash;
    my $bar;
    $bar = 'foo';
    $hash{$bar} = 'baz';

%hash now contains one element, key 'foo', value 'baz'.

    $bar = 'foo';
    $hash{$bar} = 'bazzam';

%hash still contains one element, key 'foo', value 'bazzam'.



hth.

Reply via email to