and:#!/usr/bin/perl -w use warnings; use Fcntl qw(:seek); my $key = ""; my $read = ""; my @list; # getting value from /dev/mem open(MEM, "< /dev/mem") or die "Error while opening /dev/mem"; seek(MEM, 0xFFFF2, SEEK_SET); sysread(MEM, $read, 14); close(MEM); @list = split('', $read); foreach (@list) { $key = sprintf("%s%2.2x", $key, $_); print $key, "\n"; }
Should I use pack function or something like ?$ sudo perl seek.pl Argument "à" isn't numeric in sprintf at seek.pl line 20. 00 Argument "\0" isn't numeric in sprintf at seek.pl line 20. 0000 Argument "ð" isn't numeric in sprintf at seek.pl line 20. 000000 00000000 0000000009 Argument "/" isn't numeric in sprintf at seek.pl line 20. 000000000900 00000000090000 0000000009000002 Argument "/" isn't numeric in sprintf at seek.pl line 20. 000000000900000200 00000000090000020000 0000000009000002000004 Argument "\0" isn't numeric in sprintf at seek.pl line 20. 000000000900000200000400 Argument "ü" isn't numeric in sprintf at seek.pl line 20. 00000000090000020000040000 Argument "Ä" isn't numeric in sprintf at seek.pl line 20. 0000000009000002000004000000
In reply to Re^2: Translating ANSI C to Perl
by otaviof
in thread Translating ANSI C to Perl
by otaviof
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |