develooper Front page | perl.beginners | Postings from July 2012

Concatenation in Perl

Thread Next
From:
punit jain
Date:
July 19, 2012 03:37
Subject:
Concatenation in Perl
Message ID:
CAFXWBQLo4WCMygNvRwNmTvi5MAs8ejGEd2y4UOYoAcyhAvvROQ@mail.gmail.com
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

Output from above is - *not in:Inbox and not in:Sent and*
Expected is = *not in:Inbox and not in:Sent* ----> ie without extra and
after Sent

I tried this with join as well as :-

my $query="";
foreach my $folder ( @folders )
{
$query = join "and" "not in:$folder" "$query";
}

but still same result and this time extra "and" in beginning.

 Any idea how to do this ?


Best Regards.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About