Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: The magic dollar

by b-funk (Sexton)
on Aug 29, 2003 at 01:54 UTC ( [id://287568]=note: print w/replies, xml ) Need Help??


in reply to Re: The magic dollar
in thread The magic dollar

I was only mildly impressed by this until I tried to sort it all out. It's a great one, really quite complex. I think the solution is pretty clear and correct. Nice job xiper.

#!/usr/bin/perl BEGIN { undef $; # $; is $SUBSCRIPT_SEPARATOR } $- > new; # $- is $FORMAT_LINES_LEFT $~ = '10011011001111001110101000000100100011'; # $FORMAT_NAME $. = '31150460500070422151862305023215186070'; # $INPUT_LINE_NUMBER unless( $= = 0 ) # just an assignment to $= # always returns 0 here { $_ = ( $. . 9_630_151_829 ); # appends '9630151829' to previous $. # and assigns to $_ $. = $; # $. is undef now } not map # map #1: builds the YAHOP string { map # map #2: builds the individual words { $* = 2**6; # $MULTILINE_MATCHING $^ = substr( $~, $_, 6 ); # this grabs various 6-digit strings # from $~ and stores them in $^ map { $= = $= + $_ } # map #3: $= is undef at the beginning # of this so it ends up being the # decimal representation of $^ above map { $_ * ( $* /= 2 ) } # map #4: converts each bit received # from the split() to decimal and # passes the list to map #3 split( $, , $^ ); # $, is undef by default, so it splits # $^ into its six binary digits and # returns the list to map #4 $. .= chr( $= + 72 ); # $. is the YAHOP string to be printed # later; xiper subtracted an offset # from each of the characters just be +cause $= = $; # $= is undef } # returns two character chunks of $_ in a list to map #2 # remember that $_ is aliased from down below /../g; # $" is a space by default, so insert a space after each word $. .= $" ##"; # comment } # the split returns the five words in their proper numeric format # to map #1, then it dies split 6 or die $. . $/ #.+$/g; # comment, not regex

Brandan L.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://287568]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-19 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found