Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Perl Golf Proposal

by cLive ;-) (Parson)
on May 23, 2001 at 06:06 UTC ( #82452=note: print w/replies, xml ) Need Help??


in reply to Perl Golf Proposal

sub i{$_=<>;chop;if(/^\d{1,4}$/){return sprintf("%04d",$_)}print"!\n"; +&i}$c=i;$d=i;for($c..$d){$_="bar$_.jpg";print"$_\n"unless(-e)}

Enter first then last in sequence. no check made that second number is larger than first (not in challenge :))

! means re-enter digit

131 chars (includes 'bonus' challenge).

Hmmm, that was fun :)

cLive ;-)

Update: if larger strings *are* valid as long as they are numerically correct, the above needs amending to:

sub i{$_=<>;chop;if(/^\d+$/&&$_<10000){return sprintf("%04d",$_)}print +"!\n";&i}$c=i;$d=i;for($c..$d){$_="bar$_.jpg";print"$_\n"unless(-e)}

adding another 6 chars...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://82452]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2016-12-03 19:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (59 votes). Check out past polls.