hex-array print

Discussion in 'Perl Misc' started by joe.cipale@radisys.com, Sep 29, 2005.

  1. Guest

    I am using perl to write a acript that will retreive SNMP data and
    possibly modify SNMP values for a given object on a switch.

    If I retreive the SNMP data using the standard Net-SNMP command
    (snmpget), the data I see is:Hex-STRING:FF FF FF F0 00 00 00

    If, on the other hand, I use the SNMP package written in perl, the data
    is sreturned as such: yyy0. I have tried to have the data stored as an
    array (@hex_data) and attempted to access the data by walking through
    it one character at a time with no luck

    Any suggestions?

    Thanks

    Joe
     
    , Sep 29, 2005
    #1
    1. Advertising

  2. wrote:
    > I am using perl to write a acript that will retreive SNMP data and
    > possibly modify SNMP values for a given object on a switch.
    >
    > If I retreive the SNMP data using the standard Net-SNMP command
    > (snmpget), the data I see is:Hex-STRING:FF FF FF F0 00 00 00
    >
    > If, on the other hand, I use the SNMP package written in perl, the data
    > is sreturned as such: yyy0. I have tried to have the data stored as an
    > array (@hex_data) and attempted to access the data by walking through
    > it one character at a time with no luck
    >
    > Any suggestions?


    The y's you are seeing probably have diacritical marks?

    perldoc -f unpack

    --
    Josef Möllers (Pinguinpfleger bei FSC)
    If failure had no penalty success would not be a prize
    -- T. Pratchett
     
    Josef Moellers, Sep 30, 2005
    #2
    1. Advertising

  3. Joe Smith Guest

    wrote:
    > I am using perl to write a acript that will retreive SNMP data and
    > possibly modify SNMP values for a given object on a switch.
    >
    > If I retreive the SNMP data using the standard Net-SNMP command
    > (snmpget), the data I see is:Hex-STRING:FF FF FF F0 00 00 00
    >
    > If, on the other hand, I use the SNMP package written in perl, the data
    > is returned as such: yyy0.


    I think you mean ÿÿÿð.

    > I have tried to have the data stored as an
    > array (@hex_data) and attempted to access the data by walking through
    > it one character at a time with no luck


    pack() and unpack() were created for just such.

    perl -le '$_="\xff\xff\xff\xf0"; print "$_ = ",unpack "H*",$_'
    ÿÿÿð = fffffff0

    -Joe
     
    Joe Smith, Sep 30, 2005
    #3
  4. Guest

    Hi!

    Another poster suggested pack()/unpack() as well. Another route I have
    chosen, some a modicum of success is to downloand/install Net::SNMP,
    which is a newer, updated version of the SNMP.pm package.

    I will play with pack/unpack, as Net::SNMP places restrictions on what
    I can/cant do.

    Thanks for your help!

    Joe
     
    , Sep 30, 2005
    #4
  5. wrote:
    > Hi!
    >
    > Another poster suggested pack()/unpack() as well. Another route I have
    > chosen, some a modicum of success is to downloand/install Net::SNMP,
    > which is a newer, updated version of the SNMP.pm package.
    >
    > I will play with pack/unpack, as Net::SNMP places restrictions on what
    > I can/cant do.
    >
    > Thanks for your help!


    You're welcome.
    In the future: could you please quote some context?

    --
    Josef Möllers (Pinguinpfleger bei FSC)
    If failure had no penalty success would not be a prize
    -- T. Pratchett
     
    Josef Moellers, Oct 4, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    10
    Views:
    6,229
    Neredbojias
    Aug 19, 2005
  2. Bengt Richter
    Replies:
    6
    Views:
    474
    Juha Autero
    Aug 19, 2003
  3. jack
    Replies:
    4
    Views:
    590
  4. tim

    hex string to hex value

    tim, Nov 22, 2005, in forum: Python
    Replies:
    8
    Views:
    18,892
  5. mathog
    Replies:
    11
    Views:
    824
Loading...

Share This Page