Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Extracting full digits from a range

by bart (Canon)
on Aug 03, 2012 at 18:44 UTC ( #985308=note: print w/replies, xml ) Need Help??


in reply to Extracting full digits from a range

You have to
  1. get the start and end values,
    my($min, $max) = /\b([0-9a-f]+):([0-9a-f]+)\b/i;
  2. convert them to integers
    foreach($min, $max) { $_ = hex($_); }
  3. turn them into a range or span:
    my @list = $min .. $max;
  4. turn each into a hex number.
    my @hex = map { sprintf '%X', $_ } $min .. $max;
    will do.
  5. print out the list with ',' between them:
    $, = ','; print @list;
    update Oops, that should have been
    $, = ','; print @hex;

Replies are listed 'Best First'.
Re^2: Extracting full digits from a range
by cztmonk (Monk) on Aug 04, 2012 at 10:42 UTC

    Did you test? It outputs

    10559,10560,10561,10562,10563,10564,10565
      Yeah, I printed the wrong list.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://985308]
help
Chatterbox?
[oiskuu]: Hm. that depends on kernel compiled with CONFIG_AUDITSYSCAL L
[tye]: apropos my several mentions of audit
[Corion]: At least my (non-SELinux) Debian has that config thing set. I don't have non-Debian machines handy (except Android)
[Corion]: My Android phone also has /proc/self/ loginuid, but that displays -1 (resp. 4GB). That might be because the phone is rooted.
[tye]: -1 means nobody logged in or the process was started before audit got booted
[davido]: ok, on my ubuntu system getlogin grabs from /proc/self/ loginuid (per strace)

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2017-06-23 19:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (554 votes). Check out past polls.