NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
you could also inline it (Score:1)
#!/usr/bin/perl
use strict;
use warnings;
my @a = (
1,
@{[map {()} warn "in here\n"]},
2,
3
);
print map { "$_\n" } @a;
Reply to This
Re: (Score:1)
or the slightly less stupid (I don't know why I threw it in an arrayref to start with):
#!/usr/bin/perl
use strict;
use warnings;
my @a = (
1,
(map {()} warn "in here\n"),
2,
3
);
print map { "$_\n" } @a;
Re: (Score:1)
An even shorter way to write that is this:
However, I prefer to take a page from Javascript, by defining the following amusing function:
I can then write the code in this much nicer way:
This is far nicer than Ovid’s approach as well, IMO.
Re: (Score:2)
Ah, that is a nicer solution, thanks.