scanf equivalent?

2004-09-07 Thread David D Miller




Experts:

How do I do the equivalent of scanf in perl?

My problem is to read a hex value from a file and process it in binary.
For instance, I read a file containing data of the form 0x0b4f.  Then I
need to mask/shift etc that data before displaying it.

dave.

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: scanf equivalent?

2004-09-07 Thread Johan Lindstrom
At 21:47 2004-09-07, David D Miller wrote:
My problem is to read a hex value from a file and process it in binary.
For instance, I read a file containing data of the form 0x0b4f.  Then I
need to mask/shift etc that data before displaying it.
You probably want hex().
perl -e print hex('0x0b4f')
perl -e printf('%x', hex('0x0b4f'))
perldoc -f hex
/J
 --  --- -- --  --  - - --  -
Johan LindströmSourcerer @ Boss Casinos   johanl AT DarSerMan.com
Latest bookmark: TCP Connection Passing
http://tcpcp.sourceforge.net/
dmoz: /Computers/Programming/Languages/JavaScript/ 12
___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: scanf equivalent?

2004-09-07 Thread David D Miller




Exactly what I need.  Thanks!

dave.



At 21:47 2004-09-07, David D Miller wrote:
My problem is to read a hex value from a file and process it in binary.
For instance, I read a file containing data of the form 0x0b4f.  Then I
need to mask/shift etc that data before displaying it.

You probably want hex().

perl -e print hex('0x0b4f')
perl -e printf('%x', hex('0x0b4f'))
perldoc -f hex


/J

 --  --- -- --  --  - - --  -
Johan LindströmSourcerer @ Boss Casinos   johanl AT DarSerMan.com

Latest bookmark: TCP Connection Passing
http://tcpcp.sourceforge.net/
dmoz: /Computers/Programming/Languages/JavaScript/ 12

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs




___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


Re: scanf equivalent?

2004-09-07 Thread Michael
Take me off this list please!Submitted by:   [EMAIL PROTECTED]   One day at a time!
		Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs