Honestly, his program consists mostly of a long URL. What does he hope to get out of this?

Update: Screw golf, it's not even good code.

The following is so much better, and by his count, it's only 4 lines even though it's practically not golfed:

#!/usr/bin/perl -MIO::Socket my $body = join('&', "vid=$ARGV[0]", "private=0", "geolat=".( $ARGV[1] + rand() * 0.0001 - 0.00005 ), "geolong=".( $ARGV[2] + rand() * 0.0001 - 0.00005 ), ); sleep(rand()*600); print( { my $sock = IO::Socket::INET->new( PeerAddr => 'api.foursquare.com:80', Proto => 'tcp', ) or die $! } join("\r\n", 'POST /v1/checkin HTTP/1.1', 'Host: api.foursquare.com', 'User-Agent: Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en)' .' AppleWebKit/420+ (KHTML, like Gecko)' .' Version/3.0 Mobile/1C10 Safari/419.3', 'Content-Type: application/x-www-form-urlencoded', 'Authorization: Basic XXXXXX', 'Content-length: '.length($body), "", $body, ), ); $_ = <$sock>;

I'm not convinced that long User-Agent is required. And you can surely get away with not waiting for the reply. (Could fail, but not likely.)

I was tempted to write the User-Agent as equivalent

'User-Agent: Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en)', 'User-Agent: AppleWebKit/420+ (KHTML, like Gecko)', 'User-Agent: Version/3.0 Mobile/1C10 Safari/419.3',

In reply to Re: Nine-line Perl example of gaming a geolocation service and an open invitation to golf it by ikegami
in thread Nine-line Perl example of gaming a geolocation service and an open invitation to golf it by mr_mischief

Title:
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, details, 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, summary, 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.