Hi,

I have some problem here, I can't skip/read/get/replace null/empty variable/parameters here and the error message was displayed as below. Otherwise, a details program or others information can be reas as below :

Error Message

Use of uninitialized value in substitution (s///) at ./alc_test.pl lin +e 40. Use of uninitialized value in pattern match (m//) at ./alc_test.pl lin +e 41. Use of uninitialized value in concatenation (.) or string at ./alc_tes +t.pl line 47. IROUTE: [6005494c523142] (ILR1B) === OROUTE: [] (THANKS) Use of uninitialized value in substitution (s///) at ./alc_test.pl lin +e 31. Use of uninitialized value in pattern match (m//) at ./alc_test.pl lin +e 32. Use of uninitialized value in substitution (s///) at ./alc_test.pl lin +e 40. Use of uninitialized value in pattern match (m//) at ./alc_test.pl lin +e 41. Use of uninitialized value in concatenation (.) or string at ./alc_tes +t.pl line 47. Use of uninitialized value in concatenation (.) or string at ./alc_tes +t.pl line 47. Died at ./alc_test.pl line 26.
Test.txt files :
Name : >Mick< [Mick] IC : '91919191929' (9191919129) PC : 123 (123) Number : >1960132400000< (1960132400000) Location : >000e 0036< (000e 0036) extension : >< Capability : >"CARES< ("CARES) Info : >6005494c523142< (6005494c523142) Name : >Nick< (Nick) IC : '1235467000' (1235467000) PC : 124 (124) Number : >1960192500000< (1960192500000) Location : >000f 0034< (000f 0034) extension : >< Capability : >< Info : ><
Program is here:
#!/usr/bin/perl -w use constant INROUTE => "THANKS"; my $iroute = "XXX"; my $oroute = "YYY"; while (1) { $/ = ""; @entries = (); open (F, "cat test.txt |") or warn ("Can't open test.txt"), ne +xt; while (<F>) { next unless $_ !~ /^#/; s/\s+:/:/g; s/(\'|<|>|\")//g; my $ref_entry = {}; foreach (split /\n/) { $$ref_entry{$1} = $2 if /^(.*):\s+(.*)\((.*)\) +$/; } push @entries, $ref_entry; } close (F); printreport() if scalar(@entries) > 1; die; } sub printreport { foreach $ref (@entries) { ($iroute = $$ref{"Info"}) =~ s/\s+//g; if ( $iroute !~ /""|\.|^$|^\s+$/ ) { @str1 = unpack ("x4 A2 A2 A2 A2 A2", $iroute); $tmproute = join ('', map {chr hex} @str1); ($inroute = $tmproute) =~ s/\s+//g; } else { $inroute = INROUTE; } ($oroute = $$ref{"Required Bearer Capability"}) =~ s/\ +s+//g; if ( $oroute !~ /^$|""|^\s+$/ ) { $outroute = $oroute; } else { $outroute = INROUTE;<br> } print ("IROUTE: [$iroute] ($inroute) === OROUTE: [$oro +ute] ($outroute)\n"); } } Hopefully, somebody can give me some advise. Thanks you, bh_perl

update (broquaint): added <code> tags and drop '=' separators


In reply to How to read/replace null value/parameters by bh_perl

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.