Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > hex-array print

Reply
Thread Tools

hex-array print

 
 
joe.cipale@radisys.com
Guest
Posts: n/a
 
      09-29-2005
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

 
Reply With Quote
 
 
 
 
Josef Moellers
Guest
Posts: n/a
 
      09-30-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) 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

 
Reply With Quote
 
 
 
 
Joe Smith
Guest
Posts: n/a
 
      09-30-2005
(E-Mail Removed) 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
 
Reply With Quote
 
joe.cipale@radisys.com
Guest
Posts: n/a
 
      09-30-2005
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

 
Reply With Quote
 
Josef Moellers
Guest
Posts: n/a
 
      10-04-2005
(E-Mail Removed) 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
print a vs print '%s' % a vs print '%f' a David Cournapeau Python 0 12-30-2008 03:19 AM
Problem - I want to print Current Output of Pdf file and should print once.I get print dialog box but it is not working keto Java 0 05-30-2007 11:27 AM
Can't print to print server =?Utf-8?B?cGVjaw==?= Wireless Networking 2 02-03-2005 02:41 PM
How to make use of "print to file" option by print =?Utf-8?B?enljZ3M=?= MCSE 1 01-04-2005 06:50 PM
Unlarging the print to print using PDF file to print Bun Mui Computer Support 3 09-13-2004 03:15 AM



Advertisments