On Mon, Feb 25, 2008 at 3:00 PM,
<[EMAIL PROTECTED]> wrote:
> > "David Golden" <[EMAIL PROTECTED]> wrote on 02/23/2008 03:00:19 PM:
> > > my $regex = join q{}, map { $num2chars[$_] } @digits;
>
> The only thing I would object to is the q{}. There's really no point
> in using the q{} operator ... it just confuses the point here.
>
> my $regex = join '', map { $num2chars[$_] } @digits;
At least on my screen, the two '' looks just like a signle ". Using
q{} instead is a bit of PBP style I've come to adopt, but I can
certainly see how it could be confusing to some.
> And it could actually just as well be written as
>
> my $regex = join '', @[EMAIL PROTECTED];
>
Except for my typo, which Woody pointed out. It should have been this:
my $regex = join q{}, map { "[$num2chars[$_]]" } @digits;
Though arguably, @num2chars could have been constructed to have the
character class brackets already. I do think that map will be
understood at a lower point of Perl fluency than slices, but that's a
fairly arbitrary distinction. :-) In the actual contest entry, of
course, the map was chained with the split, so it all just worked well
together that way. Your slice syntax is more elegant, certainly.
David
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs