Ian Philipps writes:
Perhaps some of the baroque constructions seen in this thread are
actually a game of perl flog, designed to be the longest possible
solution :-)
I tried to coin the term Perl Bowling once (in a post to c.l.p.misc), but
it didn't catch on!
I wonder why :)
--Ala
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Monday, February 4, 2002, at 07:35 , Ala Qumsieh wrote:
I tried to coin the term Perl Bowling once (in a post to
c.l.p.misc), but
it didn't catch on!
I wonder why :)
That's a shame -- I think it's a good name. The only problem, I
think, is
On 4 Feb 2002, at 8:19, Craig S. Cottingham wrote:
How about Perl 21? The moderator posts a problem ala Perl
golfing, but also posts the size of a secret, reference
solution. The other players try to some up with solutions that
come as close as possible in size to the reference solution,
:)
On Monday, February 4, 2002, at 09:37 AM, Bernie Cosell wrote:
On 4 Feb 2002, at 8:19, Craig S. Cottingham wrote:
How about Perl 21?
even easy to make it any particular length, in a dozen different ways.
I believe Perl 'Go Fish' would be better -
* You find sets of solutions which
Well ...
On Monday, February 4, 2002, at 10:38 AM, Yanick wrote:
Why, oh why, do I have the feeling a Perl drinking game is
not far ahead?
I am pretty sure I would die from drinking TOO much then :/
How many strokes causes Alcohol Poisoning?
:)
_Sx
('
Craig Cottingham writes:
How about Perl 21? The moderator posts a problem ala Perl
golfing, but also posts the size of a secret, reference
solution. The other players try to some up with solutions that
come as close as possible in size to the reference solution,
without going over.
Bill -OSX- Jones schreef op 04 februari 2002:
I believe Perl 'Go Fish' would be better -
Go Fish? Google-de-google... Ah, Kwartetten!
* You find sets of solutions which match RegEx from a given problem.
Or: find the RegEx, given a number of strings that match it. A kind of
Perl Zendo (see
On Mon, Feb 04, 2002 at 05:09:53PM +0100, Eugene van der Pijll wrote:
Or: find the RegEx, given a number of strings that match it. A kind of
Perl Zendo (see http://www.wunderland.com/WTS/Kory/Games/Zendo/ for an
explanation of Zendo).
Or a Perlish hangman?
The gamemaster
On Mon, Feb 04, 2002 at 05:35:08PM +0100, Philippe 'BooK' Bruhat wrote:
Or a perlish wheel of fortune.
The master write some Perl code (not particularly golfed or obfuscated)
and let players ask for a letter / symbol. The aim is to find the
correct code. Maybe a little help is given, like
Yanick wrote:
On Mon, Feb 04, 2002 at 05:35:08PM +0100, Philippe 'BooK' Bruhat wrote:
Or a perlish wheel of fortune.
The master write some Perl code (not particularly golfed or obfuscated)
and let players ask for a letter / symbol. The aim is to find the
correct code. Maybe a little
On Mon, Feb 04, 2002 at 09:26:54PM +0100, Bart Lateur wrote:
On Mon, 04 Feb 2002 12:01:16 -0500, Steve Lane wrote:
just require that if a variable name contains
a letter, then that letter must be 'z' (or whatever).
$z, $zz, $, @z, etc.
I take: the letter...!
*ding* *ding*
Next you'll want to replace 13.57831 by 13.58 without
using sprintf().
Trival...
$var = 13.57831;
$var =~
s/^([+-]?)(\d*)(?:(?:\.?)(\d{0,2})(\d?))?\d*$/$1$2\..(1length$3?00:(2length$3?$3.0:(5$4?$3:$3+1)))/e;
Or how about:
$var =~ s'13.57831'13.58';
Jonathan Paton
On Feb 4, Yanick said:
On Mon, Feb 04, 2002 at 05:35:08PM +0100, Philippe 'BooK' Bruhat wrote:
Or a perlish wheel of fortune.
I will take the dollar sign...
*ding* *ding* *ding* *ding* *ding* *ding* *ding* *ding* *ding* *ding*
I have an interesting idea. Take Perl code, and
On 4 Feb 2002, at 16:32, Jeff 'japhy' Pinyan wrote:
On Feb 4, Yanick said:
On Mon, Feb 04, 2002 at 05:35:08PM +0100, Philippe 'BooK' Bruhat wrote:
Or a perlish wheel of fortune.
I will take the dollar sign...
*ding* *ding* *ding* *ding* *ding* *ding* *ding* *ding* *ding*
On Feb 4, Dave Hoover said:
Maybe it could be made into more of a contest by seeing HOW MANY working
programs one can create from a chunk of jumbled code.
Yeah, but that can be brute-forced with an algorithm.
--
Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI
Jeff 'japhy' Pinyan [EMAIL PROTECTED] wrote:
On Feb 4, Dave Hoover said:
Maybe it could be made into more of a contest by
seeing HOW MANY working
programs one can create from a chunk of jumbled
code.
Yeah, but that can be brute-forced with an
algorithm.
Good point.
--Dave
On Mon, Feb 04, 2002 at 04:32:29PM -0500, Jeff 'japhy' Pinyan wrote:
I have an interesting idea. Take Perl code, and jumble it around to
something else (valid or not) and state the original code's purpose.
# find all prime numbers
$_||=(1)^(\1/~++$$)while +x._/+1;print
The comment
On Feb 4, Yanick said:
On Mon, Feb 04, 2002 at 04:32:29PM -0500, Jeff 'japhy' Pinyan wrote:
# find all prime numbers
$_||=(1)^(\1/~++$$)while +x._/+1;print
(1x$_)=~/^(.1+)\1+$/||print while++$_
and int he grand tradition of putting stuff
back together, I'm left with one
On Mon, Feb 04, 2002 at 05:14:51PM -0500, Yanick wrote:
On Mon, Feb 04, 2002 at 04:32:29PM -0500, Jeff 'japhy' Pinyan wrote:
I have an interesting idea. Take Perl code, and jumble it around to
something else (valid or not) and state the original code's purpose.
# find all prime
On Feb 4, Paul Makepeace said:
$_||=(1)^(\1/~++$$)while +x._/+1;print
(1x$_)=~/^(.1+)\1+$/||print while++$_;
That's what I had (module layout) but couldn't figure out how to get rid
of the initial 1, which isn't prime.
That's a minor flaw of the program, and is implicitly excused.
The
On Fri, 01 Feb 2002 at 10:58:10 -0500, Ala Qumsieh wrote:
Rick Klement writes:
s/\b\d\b/0$/g
(it's the effects of playing a lot of golf lately... :)
Golf?!
s|\b\d/|0$|g
Perhaps some of the baroque constructions seen in this thread are
actually a game of perl flog, designed to
Anthony == Anthony J Breeds-Taurima [EMAIL PROTECTED] writes:
Anthony On Thu, 31 Jan 2002, Michael G Schwern wrote:
Folks, I'm clawing my eyes out here. Stop hitting the regex crack pipe!
Anthony the poster asked for a regex solution.
Where?
--
Randal L. Schwartz - Stonehenge Consulting
yes - that was not the *original* post however.
On Saturday, February 2, 2002, at 10:27 AM, Dave Hoover wrote:
--- Pradeep Sethi wrote:
Thanks but I am looking of any regexp substitution.
The original asked for efficiency.
So Michael stated he was clawing his eyes out (then I was LMAO.)
liked :
s/\b\d\b/0$/g;
Regards
Pradeep
-Original Message-
From: [EMAIL PROTECTED]
To: Pradeep Sethi
Sent: 2/2/02 7:00 AM
Subject: Re: substitution question
The following message is a courtesy copy of an article
that has been posted to perl.fwp as well.
Pradeep == Pradeep Sethi [EMAIL
On Sat, 2 Feb 2002 12:35:13 -0800 , Pradeep Sethi wrote:
and I want to use regexp , without using sprinf.
!?!?!!
WTF is wrong with sprintf()? It's a proper tool for this job. Next
you'll want to replace 13.57831 by 13.58 without using sprintf().
Which is doing things the hard way.
Also want
On Sat, 02 Feb 2002 22:24:05 +0100, [EMAIL PROTECTED] (Bart Lateur)
wrote:
On Sat, 2 Feb 2002 12:35:13 -0800 , Pradeep Sethi wrote:
and I want to use regexp , without using sprinf.
!?!?!!
WTF is wrong with sprintf()? It's a proper tool for this job. Next
you'll want to replace
On Thu, 31 Jan 2002 22:10:03 -0500, Michael G Schwern wrote:
$date =~ s{(.*)}{sprintf '%02d/%02d/%d', split '/', $1}e;
$date =~ s{(\d+)/(\d+)/(\d+)}{sprintf '%02d/%02d/%d', $1, $2, $3}e;
--
Bart.
On Friday 01 February 2002 02:26, Bart Lateur wrote:
On Thu, 31 Jan 2002 22:10:03 -0500, Michael G Schwern wrote:
$date =~ s{(.*)}{sprintf '%02d/%02d/%d', split '/', $1}e;
$date =~ s{(\d+)/(\d+)/(\d+)}{sprintf '%02d/%02d/%d', $1, $2, $3}e;
$date = sprintf '%02d/%02d/%d', $date
On Fri, 1 Feb 2002, John W.Krahn wrote:
On Friday 01 February 2002 02:26, Bart Lateur wrote:
On Thu, 31 Jan 2002 22:10:03 -0500, Michael G Schwern wrote:
$date =~ s{(.*)}{sprintf '%02d/%02d/%d', split '/', $1}e;
$date =~ s{(\d+)/(\d+)/(\d+)}{sprintf '%02d/%02d/%d', $1, $2, $3}e;
Rick Klement writes:
Pradeep Sethi wrote:
Hi All,
I want to change date 9/9/1987 to 09/09/1973
was wondering, what is the most efficient way ?
s/\b\d\b/0$/g
(it's the effects of playing a lot of golf lately... :)
Golf?!
s|\b\d/|0$|g
--Ala
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Thursday, January 31, 2002, at 09:10 , Michael G Schwern wrote:
On Fri, Feb 01, 2002 at 11:01:35AM +0800, Anthony J.
Breeds-Taurima wrote:
On Thu, 31 Jan 2002, Michael G Schwern wrote:
Folks, I'm clawing my eyes out here. Stop hitting the
John W. Krahn [EMAIL PROTECTED] wrote:
On Friday 01 February 2002 02:26, Bart Lateur wrote:
$date =~ s{(\d+)/(\d+)/(\d+)}{sprintf '%02d/%02d/%d', $1, $2, $3}e;
$date = sprintf '%02d/%02d/%d', $date =~ m|(\d+)/(\d+)/(\d+)|;
That's very different. Bart's doesn't translate if $date
On Fri, Feb 01, 2002 at 12:27:03AM -0800, Yitzchak Scott-Thoennes wrote:
But in some ways the regexp solutions are better since they'll leave
more malformed strings alone.
Yay! Silently failing code!
Better something that leaves $date = 'unexpected garbage' alone than
converts it to
Michael G Schwern [EMAIL PROTECTED] wrote:
I have to keep reminding myself this is FWP. When I
saw the original
post I thought it was Belfast.pm for some reason.
I've been wondering why someone would post a question
like this to FWP. There are a several more
appropriate places for a
, January 31, 2002 8:47 PM
Subject: Re: substitution question
On Thu, Jan 31, 2002 at 05:41:15PM -0800, Pradeep Sethi wrote:
Thanks but I am looking of any regexp substitution.
sorry for typo : I need to change 9/9/1973 to 09/09/1973
How about,
s/\b(.)\b/0$1/g
Paul
: Thursday, January 31, 2002 5:31 PM
To: [EMAIL PROTECTED]
Subject: Re: substitution question
Greetings, On Thursday, January 31, 2002, at 08:17 PM, Pradeep
Sethi wrote:
Hi All,
I want to change date 9/9/1987 to 09/09/1973
You want to change 1987 to 1973
On Fri, Feb 01, 2002 at 02:27:13PM -0800, Robert G. Werner wrote:
If you can be sure that slashes will be the delimiters, slit on them
and then add a '0' if the first two elements are less than 10:
my $date_str = 9/9/1973;
my @date_arr = split(/, $date_str);
for my $i (0 .. 1) {
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Thu, 31 Jan 2002, Pradeep Sethi wrote:
Thanks but I am looking of any regexp substitution.
sorry for typo : I need to change 9/9/1973 to 09/09/1973
The pathological solution:
my $date = '9/9/1973'; $date =~ s=9/9/1973=09/09/1973=;
On
You're cool, man. ;-)
--
Robert G. Werner
[EMAIL PROTECTED]
2001/9/11
Get back to your stations!
We're beaming down to the planet, sir.
-- Kirk and Mr. Leslie, This Side of Paradise,
stardate 3417.3
On Fri, 1 Feb 2002, Craig S. Cottingham
: substitution question
Greetings, On Thursday, January 31, 2002, at 08:17 PM, Pradeep
Sethi wrote:
Hi All,
I want to change date 9/9/1987 to 09/09/1973
You want to change 1987 to 1973 ?
was wondering, what is the most efficient way ?
# Assuming:
my ($sec,$min,$hour,$mday,$mon,$year
On Thu, Jan 31, 2002 at 08:31:26PM -0500, Bill -OSX- Jones wrote:
my ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime;
# Then -
my $vdate = sprintf(%02d, $mon + 1) . '/' . sprintf(%02d, $mday);
$vdate .= '/' . ($year += 1900);
Or,
my ($mday, $mon, $year) = (localtime)[3..5];
my
On Thu, Jan 31, 2002 at 05:41:15PM -0800, Pradeep Sethi wrote:
Thanks but I am looking of any regexp substitution.
sorry for typo : I need to change 9/9/1973 to 09/09/1973
How about,
s/\b(.)\b/0$1/g
Paul
but it should work in case of 09/09/1973 also ?
-Original Message-
From: Paul Makepeace [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 31, 2002 5:47 PM
To: [EMAIL PROTECTED]
Subject: Re: substitution question
On Thu, Jan 31, 2002 at 05:41:15PM -0800, Pradeep Sethi wrote
Pradeep Sethi wrote:
but it should work in case of 09/09/1973 also ?
How about this? (golfers, please don't laugh at me;-):
my $x = '9/8/1973';
my ($d, $m, $y) = $x =~ m!(\d\d?)/(\d\d?)/(\d+)! or
die invalid date\n;
my $z = sprintf(%.2d/%.2d/%d, $d, $m, $y);
print $z\n;
/-\ndrew
Pradeep Sethi wrote:
Hi All,
I want to change date 9/9/1987 to 09/09/1973
was wondering, what is the most efficient way ?
s/\b\d\b/0$/g
(it's the effects of playing a lot of golf lately... :)
--
Rick Klement
On Thu, 31 Jan 2002, Pradeep Sethi wrote:
Thanks but I am looking of any regexp substitution.
sorry for typo : I need to change 9/9/1973 to 09/09/1973
---
$date=9/09/1973;
$date=~s{(\d+/)} {$110?0$1:$1}ge;
print $date,$/;
---
Can't comment on effiency ??? also will do stange things to
On Thu, Jan 31, 2002 at 05:17:17PM -0800, Pradeep Sethi wrote:
Hi All,
I want to change date 9/9/1987 to 09/09/1973
was wondering, what is the most efficient way ?
Probably not:
$_ = '9/9/1987';
$=;$_=
@{[(m|(\d)|g)[qw]
3 0 2 1 5 ]],$+-4]};
s| .|0$/|x ;
s|(?=\D).|0$/|x ;
On Thu, Jan 31, 2002 at 05:41:15PM -0800, Pradeep Sethi wrote:
Thanks but I am looking of any regexp substitution.
sorry for typo : I need to change 9/9/1973 to 09/09/1973
Some of the solutions posted are almost straight out of my Ineffective
Perl Programming talk. *sigh*
Assuming its
On Fri, Feb 01, 2002 at 12:52:58PM +1100, [EMAIL PROTECTED] wrote:
my $z = sprintf(%.2d/%.2d/%d, $d, $m, $y);
print $z\n;
printf.
--
Michael G. Schwern [EMAIL PROTECTED]http://www.pobox.com/~schwern/
Perl Quality Assurance [EMAIL PROTECTED] Kwalitee Is Job One
Don't step
On 31 Jan 02 at 05:17:17PM, Pradeep Sethi wrote:
Hi All,
I want to change date 9/9/1987 to 09/09/1973
I assume the change in year was an accident.
was wondering, what is the most efficient way ?
Well, this won't be the most efficient way, but it should be
reasonably efficient, and will
On Fri, Feb 01, 2002 at 01:39:05PM +1100, [EMAIL PROTECTED] wrote:
Well, this won't be the most efficient way, but it should be
reasonably efficient, and will work with dates that include varying
degrees of pre-existing zero-padding.
snip
$date =~ s%^(\d)(?=/)%0$1%;
$date =~
/1973
I would use printf's, tho, even tho I love regexps. :)
Jason
- Original Message -
From: Paul Makepeace [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 31, 2002 8:47 PM
Subject: Re: substitution question
On Thu, Jan 31, 2002 at 05:41:15PM -0800, Pradeep Sethi wrote
On Thu, 31 Jan 2002, Michael G Schwern wrote:
Folks, I'm clawing my eyes out here. Stop hitting the regex crack pipe!
the poster asked for a regex solution.
Yours Tony.
/*
* The significant problems we face cannot be solved at the
* same level of thinking we were at when we created
On Fri, Feb 01, 2002 at 11:01:35AM +0800, Anthony J. Breeds-Taurima wrote:
On Thu, 31 Jan 2002, Michael G Schwern wrote:
Folks, I'm clawing my eyes out here. Stop hitting the regex crack pipe!
the poster asked for a regex solution.
$date =~ s{(.*)}{sprintf '%02d/%02d/%d', split '/',
On Thu, 31 Jan 2002, Michael G Schwern wrote:
$date =~ s{(.*)}{sprintf '%02d/%02d/%d', split '/', $1}e;
That'd do it.
Yours Tony.
/*
* The significant problems we face cannot be solved at the
* same level of thinking we were at when we created them.
* --Albert Einstein
*/
On Thu, Jan 31, 2002 at 08:10:00PM -0800, Yitzchak Scott-Thoennes wrote:
In article 20020201025307.GC9474@blackrider,
Michael G Schwern [EMAIL PROTECTED] wrote:
$date = sprintf %02d/%02d/%d, split '/', $date;
Perhaps slightly more efficient:
$date = sprintf %02d/%02d/%s, split '/',
56 matches
Mail list logo