Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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";}

Comment on Understanding and Knowledge
Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: poem [id://899660]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2014-08-21 20:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (143 votes), past polls