hex-array print

J

joe.cipale

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
 
J

Josef Moellers

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
 
J

Joe Smith

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
 
J

joe.cipale

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
 
J

Josef Moellers

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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top