in reply to Re: JAPH the First
in thread JAPH the First
@_=(4,-16,17,-12.4,9,-13.17,-8.14,8,-19.4,0,18,14,-20.17,5,6,11 ,-7.19,10,2,3,1,-15.7);do{($=,$-)=(@_[$_]>=0?(-@_[$_],$_):split /\./,@_[$_]);$$[-$=]=pack q#C#,$-+=65;}foreach(0..$#_);print@$; # becomes. Note the # comments on some lines @_ = # @_ is a special list variable, thus =( implies a list. ( 4,-16,17,-12.4,9,-13.17, # big list of data... 22 in fact -8.14,8,-19.4,0,18,14, # lots of decimals -20.17,5,6,11,-7.19, # lots of negatives 10,2,3,1,-15.7 ); # ); is end of list. do { # do turns a block into a statement that can take loop modifiers ($=,$-)= # $= and $- are print format variables # wrapped in parens, they want a list. ( # ahh, a paren for a list! @_[$_] >= 0 # Conditional test for the ?: operator + tests for negative ? ( -@_[$_], $_ ) # If true, return a list of -neg value +, counter : split /\./ , @_[$_] # If false, split on . ); # end of assignment list $$[-$=] = # oh god is @$ a legal array? *sob* yes... # what does a negative array count do? pack q#C#, $- += 65; # pack 'C' is for unsigned chars # 65 is the offest to lowercase 'a' in asc +ii } foreach (0..$#_); #loop modifier for do block #loops from 0 to 21, the size of @_ print @$; #print the array!
Does that help any? You generally have to read character by character and be aware of the special variables to parse these things, then you start spotting structures once you see the variables and assignments.
--
$you = new YOU;
honk() if $you->love(perl)
|
|---|