Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I did slightly better in a couple of places, so probably wrong. I'll submit it now, before better solutions show up for everything. (Corrected holes 3 and 4 as per more-careful-readers-of-specs.)
# hole 1: 16 perl -le 'sub h1 {(pop=~/\w+/g)[4]}' -e'print h1"abc ,., de f g + hi jk"' # hole 2: 20 perl -e' goto TPC' # hole 3: 19 perl -le 'sub h3 {pop=~/^(.+?)\1+\z/s}' -e'print h3 join" ",qw(hihi +hihi)' # hole 4: 19 perl -le 'sub h4 {split"",pack"H*",@_}' -e'$,=$";print h4"68696C6f" +' # hole 5: 22 XXX see below: perl -le 'sub h5 {$_<$x or$x=$_ for@_;$x}' -e'print h5(3,5,2,8,7)' # hole 6: 38 perl -le 'sub h6 {grep{s/.//}sort map{/[aeiou]/;$&.$_}@_}' \ -e'$,=$";print h6 qw(book eel hi huge i pe +a wrap)'
oopsdate: Yes, 5 doesn't work w/o priming the temporary (which makes it 30 chars).
So, here's an overly golfish version that I managed to trim to 32:
perl -le'sub x {$_[-1]<$_[0]?pop:shift;$#_?&x:@_}' -e'print x(-3,-5,-2 +,-8,-7)'
(And yes, by the time I posted them, the solutions were all pretty much established. jmcnamara said he wasn't posting answers for a week, so it's a guess between not posting 'spoilers' and getting 'rep' -- especially when others are updating as you collect and cut and paste.  --  Anyway, it is kinda neat that, at least for these first few, the straightforward solutions are the best.)


In reply to Re: PGA Golf, Round 1 by petral
in thread PGA Golf, Round 1 by jmcnamara

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (5)
    As of 2020-06-06 15:10 GMT
    Find Nodes?
      Voting Booth?
      Do you really want to know if there is extraterrestrial life?

      Results (41 votes). Check out past polls.