Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: (golf) Interlaced Strings

by premchai21 (Curate)
on May 02, 2001 at 07:00 UTC ( #77216=note: print w/ replies, xml ) Need Help??


in reply to (golf) Interlaced Strings

#!/usr/bin/perl use strict; sub interlace { ### ENGAGE GOLF MODE ### my@a=@_;my$z='';($z=chop($a[0]).chop($a[1]).$z)while($a[0]||$a[1]) +;$z ### DISENGAGE GOLF MODE ### } print interlace 'Ti sats.', 'hsi et ';

69 chars with strict on, according to Emacs.

Update: D'oh! Changed something and forgot to change the other part to match. Now is six characters longer.


Comment on Re: (golf) Interlaced Strings
Download Code
Replies are listed 'Best First'.
Re: Re: (golf) Interlaced Strings
by Masem (Monsignor) on May 02, 2001 at 07:08 UTC
    Do you even need to define @a? I think you can drop this by 7 characters more...
    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
      Eight, you mean. But I do need to define it; since I'm passing in constants, @_ is considered read-only.
Re: Re: (golf) Interlaced Strings
by koolade (Pilgrim) on May 02, 2001 at 19:54 UTC

    Am I missing something? This doesn't work for me. $x and $y are never defined. Do you mean:

    my@a=@_;my$z='';($z=chop($a[0]).chop($a[1]).$z)while($a[0]||$a[1]);$z

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (18)
As of 2015-07-31 13:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (278 votes), past polls