Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
some devices do not insert a 0x infront of hex ip The result is that the ip could not be translated. Maybe this could solve the problem?!
################################################## sub Convert_IP { my($ip , $result , $crap); my($hex1 , $hex2 , $hex3 , $hex4); my($oct1 , $oct2 , $oct3 , $oct4); my($hex_ip) = $_[0] ; #========================================================= +================== # Manche Geräte schicken die hexadezimale IP-Adresse # ohne führendes "0X" welches eine Hexadezimale Zahl # kennzeichnet # Für den Fall das keine "0x" mitgeschickt wird unter # Umständen die $hex_ip als ASCII Zeichen intepretiert. # Diese Schleife wandelt das ASCII Zeichen in eine # Hexadezimale Zahl um # und setzt ein "0x" vor den String. Die so neu generierte # Hexadezimale Zahl # kann dann wiederum weiterverarbeitet werden #===================================================================== +====== if (length($hex_ip) ne '10') { my @hexadezimale_IP_Adresse_ohne_0x=unpack("H2" x length($hex_ip), pac +k("A*",$hex_ip)); unshift @hexadezimale_IP_Adresse_ohne_0x, "0x"; $hex_ip = join("", @hexadezimale_IP_Adresse_ohne_0x); $hex_ip =~ s/\s+//g; print qq~hex_ip: $hex_ip\n~; } if (substr($hex_ip,0,1) eq "") { $ip = "0.0.0.0"; print "IP: $ip\n"; } else { $hex_ip =~ s/0x//g; $hex1 = (substr $hex_ip,0,2); $hex2 = (substr $hex_ip,2,2); $hex3 = (substr $hex_ip,4,2); $hex4 = (substr $hex_ip,6,2); $oct1 = hex($hex1); $oct2 = hex($hex2); $oct3 = hex($hex3); $oct4 = hex($hex4); $ip = ("$oct1\.$oct2\.$oct3\.$oct4"); } return $ip; }

In reply to Re^2: Cisco SNMP CDP Poll by Anonymous Monk
in thread Cisco SNMP CDP Poll by fingers

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 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? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2022-01-20 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (56 votes). Check out past polls.

    Notices?