Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Understanding and Knowledge

by 1ee7 (Initiate)
on Apr 15, 2011 at 18:01 UTC ( #899660=poem: print w/replies, xml ) Need Help??

Not done very well, yet it is done.

#!/usr/bin/perl -w use strict; my $facts ="0a57697468206b6e6f776c6564676520636f6d657320706f7765722c20 6275742070617920686565640d"; my $truths ="4d6967687420636f6d6d616e64732070656f706c6520 7665727920706f6f726c7920696e64656564"; my $principals ="0d41207269676874656f7573206d616e207365657320 7768617420666577206772617370206669726d"; my $apprehension ="0d4120677265617465737420706f776572 726573706563742c 796f75206d757374206561726e090920200d"; my $humanity = "0a 2d 4c65657465090920200d0a"; my @knowledge = ($facts, $truths, $principals, $apprehension, $humanity); for my $understanding (@knowledge) {$understanding =~ s/([a-fA-F0-9]{2})/chr(hex $1)/eg; print $understanding ,"\n";}

Replies are listed 'Best First'.
Re: Understanding and Knowledge
by wind (Priest) on Apr 15, 2011 at 18:58 UTC

    Only thing I'd change is to use the character class \w

    $understanding =~ s/(\w{2})/chr hex $1/eg;

      Thanks! That works quite well. The char capturing regex class slipped my mind.

Re: Understanding and Knowledge
by anneli (Pilgrim) on Oct 05, 2011 at 07:50 UTC

    Thanks! You just taught me about the /e option for s!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: poem [id://899660]
Approved by Old_Gray_Bear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2017-06-26 23:33 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (595 votes). Check out past polls.