nimdokk,
Take a look at the line giving the error:
%{$hashname}=@keysandvalues;
You are using a variable as a variable name. You should probably read why that is usually considered a bad idea. A quick way to get around this is to change your data structure into a HoH. This way the hash name itself is not being created dynamically, but the keys can be.
my %hash; $hash{$hashname} = { @keysandvalues };

Cheers L~R

Update: I thought I would go beyond answering your question and point out a few other things as well.

  • You should indent inside blocks as it makes it easier to read and ensure you don't have mismatched braces
  • my ($key, $value) = split /\s*=\s*/, $_; should probably be using the 3 arg form of split. see perldoc -f split
  • if ($key =~ /^(LocalTran)(\w*)(Number)$/) { $hashname=$value; } is likely a mistake. You are either using capturing parens for no reason or if you mean to match literal parens you should escape them \(
  • $hashname=$value assumes that you will only match one time in your loop. This might be safe, it might not be. If you match more than once, you will clobber a would be hash.
  • {print "$key => ${$_}{$key}\n";} will also be causing a sym ref error with strictures

    I am sure there are some other things, but this should certainly get you started.


    In reply to Re: Problem with strict "refs" by Limbic~Region
    in thread Problem with strict "refs" by nimdokk

    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.