I am using strict, warnings and diagnostics - always.
package MTA::Profile_ARM; use strict; use warnings; use diagnostics; use MTA::MapFileScientist; use vars qw($VERSION @ISA); $VERSION = 1.0; @ISA = qw(MTA::MapFileScientist); my $ProfileInformation = { 'StartLine' => 1, 'ObjAvailable' => 1, 'Compiler' => 'ARM', 'RAMMapping' => { 'RW Data' => 1, 'ZI Data' => 1, }, 'ROMMapping' => { 'Code' => 1, '(inc. data)' => 1, 'RO Data' => 1, } }; sub AnalyseMapFile { my $self = shift; my $MapFile = $self->{MAPFILEINFO}{MAPFILECONTENT}; my $PlaceToPutInformation = $self->{MEMORYMAP}; $self->{MAPFILEINFO}{ProfileInformation} = $ProfileInformation; my $memory_section = ''; my $state = 0; my $memory_size = 0; my $state_symbol = { 1 => 'Image component sizes', 2 => ' Code \(inc\. data\) RO Data RW Data ZI Dat +a Debug Object Name', }; #Each config profile defines its own way how to parse the map-file +. #Process map-file for ( my $iterator = $ProfileInformation->{'StartLine'} ; $iterator < @$MapFile ; $iterator++ ) { chomp($MapFile->[$iterator]); next if (! $MapFile->[$iterator]); if (( $state == 0 ) && ( $MapFile->[$iterator] =~m/$MTA::Profile_ARM::state_symbo +l->{'1'}/)) { ...
However, it is still not working..
as soon as I got the issue I will post here what has been
the root-cause.

Thanks a lot!

Cheers
Tobias

Update
I have changed the regex from $MTA::Profile_ARM::state_symbol->{'1'} to $state_symbol->{'1'} and its now working fine, without any shouting for not initialized values and stuff. This is because $state_symbol is a function-local scalar, so you cannot refer to it by giving the package-path. This has been the root-cause - quite simple.

Using strict was showing me at the beginning that I had a typo, it was telling me that $state_smybol was not defined. My mistake has been, that I have not got that its been a typo and extended the scalar by full path to package. Thus I got a different error and I have made things worse by not correctly reading the error msg - sorry for that !

:-)
Cheers!
Tobias

In reply to Re^4: Dereference inside a regex by tobias_hofer
in thread Dereference inside a regex by tobias_hofer

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.