On Sun, Jul 22, 2012 at 11:09:10PM +0200, Jenda Krynicky wrote:
> From: Paul Johnson
> > You need a mixture of the two approaches: map to prepend "not in:" and
> > join to join them.
> >
> > my $query = join " and ", map "not in:$_", @folders;
>
>
> @folders = ('one', 'two');
> my $query = "n
From: Paul Johnson
> You need a mixture of the two approaches: map to prepend "not in:" and
> join to join them.
>
> my $query = join " and ", map "not in:$_", @folders;
@folders = ('one', 'two');
my $query = "not in:" . join( " and not in:", @folders);
print $query;
will be quicker. no need
On 2012-07-19 12:37, punit jain wrote:
if( @folders ) {
map {$query .= "not in:$_ and"; } @folders;
print "\n $query \n";
}
'if' is not a function, so put a white space after it.
But in this case you don't need the 'if' at all.
Don't use map in void context.
Alternative code
Hi punit,
see below for my response.
On Thu, 19 Jul 2012 16:07:49 +0530
punit jain wrote:
> Hi ,
>
> I am doing a concat operation in Perl for a string like below : -
>
> if( @folders ) {
>
> map {$query .= "not in:$_ and"; } @folders;
> print "\n $query \n";
>
> }
1. "use str
On Thu, Jul 19, 2012 at 04:07:49PM +0530, punit jain wrote:
> Hi ,
>
> I am doing a concat operation in Perl for a string like below : -
>
> if( @folders ) {
>
> map {$query .= "not in:$_ and"; } @folders;
> print "\n $query \n";
>
> }
>
> @folders contain - Inbox, Sent
>
> Outpu