Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
This it the code:
if ($line[0]=~ /^c/) { $line =~/(0x[A-Fa-f0-9]+).*(0x[A-Fa-f0-9]+).*((unit=([ +0-9]+)))/i; my @error = ($1, $2); my $value1= hex $error[0]; my $value2= hex $error[1]; my $unit= $5; $line =~/(port=([0-9]+))/i; my $port= $2; print "Value1: $value1,Value2: $value2, Unit: $unit,P +ort1: $port,Stat: $line[6]\n"; } ----data------ Ctl Date Severity Alarm Message ---------------------------------------------------------------------- +-------- c0 [Mon Apr 10 15:12:42 2006] INFO (0x04:0x000B): Rebuild star +ted: unit=0 c0 [Mon Apr 10 15:12:09 2006] INFO (0x04:0x003B): Rebuild paus +ed: unit=0 c0 [Mon Apr 10 15:08:28 2006] INFO (0x04:0x000B): Rebuild star +ted: unit=0 c0 [Mon Apr 10 15:06:31 2006] ERROR (0x04:0x0002): Degraded uni +t: unit=0, port=1 c0 [Mon Apr 10 15:06:31 2006] WARNING (0x04:0x0019): Drive was re +moved from a bay: port=1
The prob:

The $2 value is wrong in the print out when there is no port... so I would need to delete it but $2 is read-only :-)

Any idea??

Thanks for the help

2006-04-11 Retitled by g0n, as per Monastery guidelines
Original title: 'matching pattens'


In reply to matching patterns by theroninwins

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-26 01:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found