Hi monks, I am assigning a xml message to a variable.Now the problem is that when I am printing that message.The varible is not reflecting . I mean suppose I have assigned a message like $message = "<event id=\"ALERT_$tier_$code1\" source=\"APP\">"; Now when I am printing the $message ,its coming <event id="ALERT_0" source="APP". The $tier value is not coming.Why is this happening?I am attaching my code also with this. Plz somebody help
my $temp; my $code; my $info; my $count = 0; my $length = scalar@contents; for(my $i=0;$i<=$length;$i++) { chomp($contents[$i]); if($contents[$i] =~ /\w+=(\d+)/){ $code = $1; $code1 = $code; chomp($contents[$i+1]); $info = $contents[$i+1]; substr($info,0,5) = ""; $temp = substr($code ,0,1); #print "$temp --> code\n"; if($temp == 1) { $tier = "WEB"; } if($temp == 2) { $tier = "APP"; } if($temp == 3) { $tier = "DB"; } if($code1 != 0) { $severity = 1; } if($code1 = 0) { $severity = 5; } #print "$code1 --> $tier\n"; $message = "<event id=\"ALERT_$tier_$code1\" source=\" +APP\">"; print "$message --messgae\n"; } }

In reply to the variable is not getting assigned by s_gaurav1091

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.