I'm new to the whole golfing game, and I'm trying to get my swing down...

Regarding this last puzzle, I've created a solution (albeit extremely long
in comparison to some of those I've seen in older puzzles), and in trying to
get a feel for the shortcuts that all of you use, I'm wondering if perhaps
you can look at what I've done and tell me how to make it shorter.

I apologize for posting this before the puzzle has been closed; I feel my
solution is so long it won't offend anyone. Here goes:

map{split/
/;[EMAIL PROTECTED];[EMAIL 
PROTECTED];my$m;map$m.="-",1..$l;map{$s[$i]=$e[$_]if($e[$_]>$s[
$i])[EMAIL PROTECTED];my$n;map$n.=" ",1...$s[$i];$e[$i]=$l+$s[$i];print"$i 
$n$m\n"}<STDIN>

I've been a fan of perl for several years, but my experience has never led
me to the map and grep functions that I've been seeing all over the place
(these functions seem to be rather nice shortcuts for "for" and "foreach"
loops). Looking at the algorithm I've used above, are there any other
obvious places where I can make this code shorter?

-o0lit3


Reply via email to