Perl Monk, Perl Meditation PerlMonks

### Comment on

 Need Help??
```my %snr;
while ( my \$line = shift @lines ) {
chomp \$line;
# (US0,--) 0.1 dB
if ( \$line =~ m/SNR Margin:\s*(\d+)\s+(\d+)\s*\(US0,--\) 0.1 dB/ )
+ {
( \$snr{us0} ) = ( \$1 );
}
# (US1,DS1) 0.1 dB
if ( \$line =~ m/SNR Margin:\s*(\d+)\s+(\d+)\s*\(US1,DS1\) 0.1 dB/
+) {
( \$snr{us1}, \$snr{ds1} ) = ( \$1, \$2 );
}
# (US2,DS2) 0.1 dB
if ( \$line =~ m/SNR Margin:\s*(\d+)\s+(\d+)\s*\(US2,DS2\) 0.1 dB/
+) {
( \$snr{us2}, \$snr{ds2} ) = ( \$1, \$2 );
}
# (US3,DS3) 0.1 dB
if ( \$line =~ m/SNR Margin:\s*(\d+)\s+(\d+)\s*\(US3,DS3\) 0.1 dB/
+) {
( \$snr{us3}, \$snr{ds3} ) = ( \$1, \$2 );
}
# (US4,DS4) 0.1 dB
if ( \$line =~ m/SNR Margin:\s*(\d+)\s+(\d+)\s*\(US4,DS4\) 0.1 dB/
+) {
( \$snr{us4}, \$snr{ds4} ) = ( \$1, \$2 );
}
}

print q{US0:}, \$snr{us0}, qq{\n};
print q{US1:}, \$snr{us1}, q{ }, q{DS1:}, \$snr{ds1}, qq{\n};
print q{US2:}, \$snr{us2}, q{ }, q{DS2:}, \$snr{ds2}, qq{\n};
print q{US3:}, \$snr{us3}, q{ }, q{DS3:}, \$snr{ds3}, qq{\n};
print q{US4:}, \$snr{us4}, q{ }, q{DS4:}, \$snr{ds4}, qq{\n};
Thats what I've managed to come up with. But I need some sort of checking as some of the SNRs will report 0 or N/A. Need it to report 0 instead of N/A.

In reply to Re^3: Telnet Output by jmutton
in thread Telnet Output by jmutton

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, 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, 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: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?
• See Writeup Formatting Tips and other pages linked from there for more info.

Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2018-07-18 05:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

Results (383 votes). Check out past polls.

Notices?