in reply to `

Yes - please follow Eily's (++) advice and use 'strict'.

Most likely, you have a typo in this line:

$PG{$temp_{$cou}} = "$start_brckt$end_brckt";
Do you actually have a hash named '%temp_" ?

Your variables could be better named, and declared within the narrowest scope.

If you post sample data, I'm sure an obliging monk would help you write code that parses it efficiently.

        What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
              -Larry Wall, 1992