Terse vs didactic. Was Re: date format
- From: Ian Wilson <scobloke2@xxxxxxxxxxxxx>
- Date: Wed, 05 Jul 2006 16:53:34 +0100
Bart Van der Donck wrote:
But of course I do like occasional "sport lines" like
$ar[3] =~ s/$m[$_]/@{[sprintf('%02g',$_+1)]}/ for (0..$#m);
in stead of splitting it up in 5 lines or so, like I would rather do in
production code. Just do myself a favour in the future :-)
Yes, so far as I can tell, the above is identical to
my $i = 0;
$ar[3] =~ s/$_/sprintf "%02g",++$i/e for (@m);
using s///e instead of s//@{[]}/
and using the array more like a list.
With didactic variable names ...
my $monthnumber = 0;
foreach my $monthname (@monthnames){
$line =~s/$monthname/sprintf "%02g", ++$monthnumber/e;
};
Which, personally, I do prefer :-)
.
- References:
- date format
- From: spross
- Re: date format
- From: Bart Van der Donck
- Re: date format
- From: Ian Wilson
- Re: date format
- From: Bart Van der Donck
- date format
- Prev by Date: Re: Win32: File Manipulation
- Next by Date: Perl Hacks: Rough Cuts Version: buy bk+net, or just book (at half the price)?
- Previous by thread: Re: date format
- Next by thread: Re: date format
- Index(es):